github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/docs/guides/message_topics.md (about)

     1  # MQTT Message Topics
     2  KubeEdge uses MQTT for communication between deviceTwin and devices/apps.
     3  EventBus can be started in multiple MQTT modes and acts as an interface for sending/receiving messages on relevant MQTT topics.
     4  
     5  The purpose of this document is to describe the topics which KubeEdge uses for communication.
     6  Please read Beehive [documentation](../modules/beehive.md) for understanding about message format used by KubeEdge. 
     7  
     8  ## Subscribe Topics
     9  On starting EventBus, it subscribes to these 5 topics:
    10  ```
    11  1. "$hw/events/node/+/membership/get"
    12  2. "$hw/events/device/+/state/update"
    13  3. "$hw/events/device/+/twin/+"
    14  4. "$hw/events/upload/#"
    15  5. "SYS/dis/upload_records"
    16  ```  
    17  
    18  If the the message is received on first 3 topics, the message is sent to deviceTwin, else the message is sent to cloud via edgeHub.
    19  
    20  We will focus on the message expected on the first 3 topics.
    21  
    22  1. `"$hw/events/node/+/membership/get"`:
    23  This topics is used to get membership details of a node i.e the devices that are associated with the node.
    24  The response of the message is published on `"$hw/events/node/+/membership/get/result"` topic.  
    25  
    26  2. `"$hw/events/device/+/state/update`":
    27  This topic is used to update the state of the device. + symbol can be replaced with ID of the device whose state is to be updated.  
    28  
    29  3. `"$hw/events/device/+/twin/+"`:
    30  The two + symbols can be replaced by the deviceID on whose twin the operation is to be performed and any one of(update,cloud_updated,get) respectively.  
    31  
    32  Following is the explanation of the three suffix used:  
    33  1. `update`: this suffix is used to update the twin for the deviceID.  
    34  2. `cloud_updated`: this suffix is used to sync the twin status between edge and cloud.  
    35  3. `get`: is used to get twin status of a device. The response is published on `"$hw/events/device/+/twin/get/result"` topic.