Topics for IoT platform communication

Introduction: Topic summary based on device practice
1 Introduction
The IoT platform is based on the Pub/Sub communication of the MQTT protocol, so topic and payload design is very important.
We can define different topics to handle different business scenarios, similar to API design in web development.


2. Customize the Topic class

2.1 Default Custom Topic
When we create a product, the system will automatically generate 3 custom topics for our convenience.

Topic Permission Remarks
/${ProductKey}/${DeviceName}/user/update Publish and report data
/${ProductKey}/${DeviceName}/user/update/error Publish to report an error event
/${ProductKey}/${DeviceName}/user/get Subscribe to receive cloud data

2.2 Custom Topic
The default topic is a demonstration. We can define Topic and Payload according to business needs to solve real problems. Like the following example:

Topic Permission Remarks
/${ProductKey}/${DeviceName}/user/heart/post Publish regularly report data
/${ProductKey}/${DeviceName}/user/bizdata/post Publish business trigger reporting
/${ProductKey}/${DeviceName}/user/biz/control Subscribe to receive cloud instructions
/${ProductKey}/${DeviceName}/user/config/modify Subscribe to receive device configuration changes
For the data reported by the device, we can classify messages of different priorities, flow and shunt them to different queues through the rule engine, and give different processing resources to avoid excessive delay of important business messages.
For cloud command reception, we can also distinguish between business commands and configuration commands, and give them different priorities.


3. System Topic list

3.1 Device Shadow
To implement the device shadow function, you need to use the following topic

Topic Permission Remarks
/shadow/update/${ProductKey}/${DeviceName} publish update device shadow QoS=1
/shadow/get/${ProductKey}/${DeviceName} Subscribe Get device shadow
The device shadow can realize the configuration update function of the operating parameters of the device.


3.2 Firmware upgrade
Topic Permission Remarks
/ota/device/inform//${ProductKey}/${DeviceName} release Report current firmware version
/ota/device/upgrade/${ProductKey}/${DeviceName} Subscribe to receive OTA information
/ota/device/progress/${ProductKey}/${DeviceName} release to report OTA progress
/ota/device/request/${ProductKey}/${DeviceName} Publish Actively request OTA information

3.3 Broadcast
Topic Permission Remarks
/broadcast/${YourProductKey}/+ Subscribe to receive broadcast information
Devices of the same product can receive broadcast commands from the cloud. Because the IoT platform limits broadcasting to a maximum of 1,000 devices.
Here we can group devices according to rules, and different groups of devices automatically subscribe to topics of different groups, for example:

/broadcast/${YourProductKey}/group/a
/broadcast/${YourProductKey}/group/b

3.4 RRPC communication
Using the following topic, the IoT platform implements a synchronous RPC call to the device initiated by the cloud based on the mqtt protocol

Topic Permission Remarks
/sys/${ProductKey}/${DeviceName}/rrpc/request/+ Subscribe to receive RRPC calls
/sys/${ProductKey}/${DeviceName}/rrpc/response/${msgId} publish response msgId corresponding to RRPC request

3.5 Device label
Use the device tag topic to dynamically add runtime tags to the device

Topic Permission Remarks
/sys/${ProductKey}/${DeviceName}/thing/deviceinfo/update release Update device label

3.6 Remote configuration
Topic Permission Remarks
/sys/${ProductKey}/${DeviceName}/thing/config/get release Actively query configuration information
/sys/${ProductKey}/${DeviceName}/thing/config/push Subscribe to receive configuration information
/sys/${ProductKey}/${DeviceName}/thing/config/get_reply Subscribe to receive configuration information

4. Object model communication

4.1 Object model JSON data communication
Topic Permission Remarks
/sys/${ProductKey}/${DeviceName}/thing/event/property/post Publish report property data
/sys/${ProductKey}/${DeviceName}/thing/event/property/post_reply Subscribe to receive the returned result
/sys/${ProductKey}/${DeviceName}/thing/event/{identifer}/post Publish report event data
/sys/${ProductKey}/${DeviceName}/thing/event/{identifer}/post_reply Subscribe to receive the returned result
/sys/${ProductKey}/${DeviceName}/thing/service/property/set Subscribe to receive property setting instructions
/sys/${ProductKey}/${DeviceName}/thing/service/property/set_reply publish Return processing result
/sys/${ProductKey}/${DeviceName}/thing/service/{identifer} Publish and receive service call instructions
/sys/${ProductKey}/${DeviceName}/thing/service/{identifer}_reply Subscribe Return service processing result

4.2 Object model transparent transmission data communication
Topic Permission Remarks
/sys/${ProductKey}/${DeviceName}/thing/model/up_raw Publish and report data
/sys/${ProductKey}/${DeviceName}/thing/model/down_raw Subscribe to receive cloud commands

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00

phone Contact Us