Updated on 2023-10-18 GMT+08:00

Broadcast Communication Usage

Broadcast Communication Usage

Figure 1 Broadcast communication sequence diagram

Procedure

  1. Initiate the connection authentication for the device. For details, see Device Connection Authentication.
  2. After the device is authenticated, initiate broadcast topic subscription. The broadcast topic must be prefixed with $oc/broadcast/. An example is as follows:

    $oc/broadcast/test  

  3. The application broadcasts a message with the topic name and message content specified.

    POST https://{Endpoint}/v5/iot/{project_id}/broadcast-messages
    Content-Type: application/json
    X-Auth-Token: ********
    
    {
      "topic_full_name" : "$oc/broadcast/test",
      "message" : "eyJhIjoxfQ=="
    }

    The topic must be prefixed with $oc/broadcast/, and the message content must be encoded using Base64.

  4. The device receives the broadcast message. Example message:

    Topic: $oc/broadcast/test  
    Data content
    {"a":1}