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":{
            "state":"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":{
            "state":"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 ACTIVE.