Stop a Remote Session

In the same manner that a remote session starts, it will also end.
As the device is already listening to the flowing topic:
$aws/things/<clientId>/shadow/name/<usageName>/update/delta
It will receive a Message:

{
   "state":{
      "delta":{
         "metadata":{
            "context":"VVVJRHMgb2YgcGFpZW5kSWQgYW5kIHNlc3Npb25JZA==",
            "state":"SESSION_IDLE",
            "stopReason":null
         },
         "data":null
      }
   }
}

The device needs to update the reported fields by sending a message to the topic:
$aws/things/<clientId>/shadow/name/<usageName>/update
Message structure: (Note the “reported” section)

{
   "state":{
      "reported":{
         "metadata":{
            "context":"VVVJRHMgb2YgcGFpZW5kSWQgYW5kIHNlc3Npb25JZA==",
            "state":"SESSION_IDLE",
            "stopReason":null
         },
         "data":null
      }
   }
}

Session Failure

If the session fails mid-session, the device will update the reported “stopReason” field with the reason it was not able to start/continue the session.

🚧

Note

The device should not change the reported “state” in a session failure and is expected to try resuming its session as long as the desired “state” is SESSION_ACTIVE.


Did this page help you?