Detecting when you have disconnected

You setup an EventListner to execute a function if a user is disconnected from a session.

For example, the function can notify the user whenever they loose connection and are no longer connected to the session.

When your client disconnects from a session, the Session object dispatches a sessionDisconnected event:

The reason property of the event is a string that describes why the session disconnected. For example, the previous example notifies the user if they were disconnected due to the network connection terminating.

For details, see SessionDisconnectEvent.