Subscribing to AWS Shadow Topic

To get information about the device’s shadow from the shadow service, the device has to subscribe to specific shadow topics. More information on shadow topics can be found here at Shadow MQTT topics.

The device subscribes to ‘$aws/things/thingName/shadow/update/delta’.The shadow service will send updates on this topic when there is a difference in attribute values. For example, the reported toggle state is 1 but a client sent a desired state for toggle as 0. The device would receive update like below:

{
          "version": 1349,
          "timestamp": 1583450271,
          "state": {
            "toggle": 0
             },
          "metadata": {
            "toggle": {
              "timestamp": 1583450271
               }
            }
        }

Further information can be found here: /update/delta

Note: Remember to replace thingName with the device's actual thing name.
Figure 1. Illustration of AWS Shadow Service Publish-Subscribe Model