消息通信Topic
大约 4 分钟
消息通信Topic
什么是Topic
Topic作为所有设备发布和订阅之间最重要的传输中介,所有具有MQTT通信能力的设备(网关设备或者子设备),都能通过对应的Topic实现消息的发送和接收
Topic格式
Topic由多个段组成,各个段的说明如图所示:
已有的Topic段:
固定部分 | 产品id | 设备id。可为网关id,也可为子设备id | 固定部分 | 模块 | 响应/动作/gateway(按需) |
---|---|---|---|---|---|
sys | {product_id} | {device_id} | thing | heart:心跳 | up:上报 |
ntp:校时 | set:写值 | ||||
properties:属性 | response:响应 | ||||
service:服务 | geteway:网关 | ||||
event:事件 | |||||
status:状态 |
Topic列表
此处是平台内置的Topic列表
分类 | 功能 | topic | 发布者 | 订阅者 | 说明 | |
系统基本功能 | 心跳 | sys/{product_id}/{device_id}/thing/heart | 网关/设备 | 平台 | device_id为网关id | |
心跳回复 | sys/{product_id}/{device_id}/thing/heart/response | 平台 | 网关/设备 | device_id为网关id | ||
时间校准 | sys/{product_id}/{device_id}/thing/ntp | 网关/设备 | 平台 | device_id为网关id | ||
时间校准回复 | sys/{product_id}/{device_id}/thing/ntp/response | 平台 | 网关/设备 | device_id为网关id | ||
设备 | 属性 | 属性上报 | sys/{product_id}/{device_id}/thing/properties/up | 网关/设备 | 平台 | device_id网关id或子设备id |
属性上报回复 | sys/{product_id}/{device_id}/thing/properties/up/response | 平台 | 网关/设备 | device_id网关id或子设备id | ||
批量属性上报 | sys/{product_id}/{device_id}/thing/properties/gateway/up | 网关/设备 | 平台 | device_id为网关id | ||
批量属性上报回复 | sys/{product_id}/{device_id}/thing/properties/gateway/up/response | 平台 | 网关/设备 | device_id为网关id | ||
属性查询全量 | sys/{product_id}/{device_id}/thing/properties/gateway/get/all | 平台 | 网关/设备 | device_id为网关id | ||
属性写值 | sys/{product_id}/{device_id}/thing/properties/set | 平台 | 网关/设备 | device_id为子设备id | ||
属性写值回复 | sys/{product_id}/{device_id}/thing/properties/set/response | 网关/设备 | 平台 | device_id为子设备id | ||
属性查询 | sys/{product_id}/{device_id}/thing/properties/get | 平台 | 网关/设备 | device_id为子设备id | ||
属性查询回复 | sys/{product_id}/{device_id}/thing/properties/get/response | 网关/设备 | 平台 | device_id为子设备id | ||
事件 | 事件上报 | sys/{product_id}/{device_id}/thing/event/up | 网关/设备 | 平台 | device_id为子设备id | |
服务 | 服务下发 | sys/{product_id}/{device_id}/thing/service/set | 平台 | 网关/设备 | device_id为子设备id | |
服务下发回复 | sys/{product_id}/{device_id}/thing/service/set/response | 网关/设备 | 平台 | device_id为子设备id | ||
在线状态 | 在线状态查询全量 | sys/{product_id}/{device_id}/thing/status/gateway/get/all | 平台 | 网关/设备 | device_id为网关id | |
在线状态上报 | sys/{product_id}/{device_id}/thing/status/gateway/up | 网关/设备 | 平台 | device_id为网关id |