Disconnect from a Session
Learn how to disconnect a user from a session.
The client disconnects from the session when you unmount the OTSession component.
To disconnect from a session, call the disconnect() method of the Session object:
To disconnect from a session, call the Session.disconnect() method.
Detecting when you have disconnected (Android)
The Session.SessionListener.onDisconnected(Session session) method is called when the client disconnects from the session.
If the connection to the session drops due to an error that occurs after a successful connection, the Session.SessionListener.onError(Session session, OpentokError error) method is called prior to the Session.SessionListener.onDisconnected(Session session) method. The OpentokError object passed into the Session.SessionListener.onError(Session session, OpentokError error) method describes the reason for the disconnection.
To disconnect from a session, call the OTSession disconnect(_:) method.
Detecting when you have disconnected (Swift)
The OTSessionDelegate sessionDidDisconnect(_:) message is sent to the session's delegate when the session disconnects.
Note that sessions automatically disconnect when the app is suspended.
If the connection to the session drops due to an error that occurs after a successful connection, the OTSessionDelegate session(_:didFailWithError:) message is sent prior to the OTSessionDelegate sessionDidDisconnect(_:) message.
The OTSessionErrorCode enum defines the code property of the OTError object passed into the OTSessionDelegate session(_:didFailWithError:) message, and it describes the reason for the disconnection.
To disconnect from a session, call the [OTSession disconnect:] method.
Detecting when you have disconnected (Objective C)
The [OTSessionDelegate sessionDidDisconnect:] message is sent to the session's delegate when the session disconnects.
Note that sessions automatically disconnect when the app is suspended.
If the connection to the session drops due to an error that occurs after a successful connection, the [OTSessionDelegate session:DidFailWithError:] message is sent prior to the [OTSessionDelegate sessionDidDisconnect:] message. The OTSessionErrorCode enum defines the code property of the OTError object passed into the [OTSessionDelegate session:DidFailWithError:] message, and it describes the reason for the disconnection.
To disconnect from a session, call the Session.Disconnect() method:
session.Disconnect();
Detecting when you have disconnected (Windows)
The Session.Disconnected message is sent when the client disconnects from the Vonage Video session.
private void Session_Disconnected(object sender, EventArgs e)
{
Console.WriteLine("Session disconnected");
}
If the connection to the session drops due to an error that occurs after a successful connection, the Session.Error event is sent prior to the Session.Disconnected event. The ErrorEventArgs object passed into the Session.Error event handler define the reason the connection dropped.
To disconnect from a session, call the otc_session_disconnect() function:
If you will not be reconnecting to the session, you should call the otc_session_delete() and otc_destroy() functions:
Detecting when you have disconnected (Linux)
When the client disconnects from the OpenTok session, the on_disconnected callback function of the otc_session_callbacks struct is called.