Automatic reconnection
Clients will attempt to automatically reconnect to a session they disconnect unexpectedly (for example, due to a drop in network connectivity).
You do not need to add any code to have the clients reconnect automatically, unless you want to respond to events dispatched when your client disconnects and reconnects.
For sample code that demonstrates the use of these events, see the opentok-reconnection repo on GitHub.
When the connection is dropped and the client tries to reconnect, the Session object dispatches a reconnecting event. When the connection is restored, the Session object dispatches a reconnected event. If the client cannot restore the connection, the client disconnects from the session, and the Session object dispatches the sessionDisconnected event.
In response to these events, your application can (optionally) display user interface notifications indicating the temporary disconnection, reconnection, and disconnection states:
When your client temporarily disconnects from a session, the Subscriber objects in clients subscribing to a stream you publish dispatch events when your published stream drops and when (and if) it resumes automatically.
For more information, see Automatic reconnection in the "Subscribing to streams" developer guide.
By default, any signals you send while your client is temporarily disconnected from a session are queued and sent when (and if) you successfully reconnect. You can set the retryAfterReconnect property to false in the options you pass into the Session.signal() method to prevent signals from being queued while you are disconnected.
For more information, see Preventing signals from being sent during automatic reconnection.
Clients will attempt to automatically reconnect to a session they disconnect unexpectedly (for example, due to a drop in network connectivity). You do not need to add any code to have the clients reconnect automatically, unless you want to respond to events dispatched when your client disconnects and reconnects.
When the connection is dropped and the client tries to reconnect, the OTSession object dispatches a sessionReconnecting event. When the connection is restored, the Session object dispatches a sessionReconnected. If the client cannot restore the connection, the client disconnects from the session, and the Session object dispatches the sessionDisconnected.
In response to these events, your application can (optionally) display user interface notifications indicating the temporary disconnection, reconnection, and disconnection states:
When your client temporarily disconnects from a session, the Subscriber objects in clients subscribing to a stream you publish dispatch events when your published stream drops and when (and if) it resumes automatically. For more information, see Automatic reconnection.
When the connection is dropped and the client tries to reconnect, the Session.ReconnectionListener.onReconnecting(Session session) method is called. When the connection is restored, the Session.ReconnectionListener.onReconnected(Session session) method is called.
If the client cannot restore the connection, the client disconnects from the Vonage Video session, and the Session.SessionListener.onDisconnected(Session session) method is called.
In response to these events, your application can (optionally) display user interface notifications indicating the temporary disconnection, reconnection, and disconnection states:
When your client temporarily disconnects from a session, methods in the implementations of the SubscriberKit.StreamListener interface in clients subscribing to a stream you publish are called when your published stream drops and when (and if) it resumes automatically.
For more information, see the Detecting when streams leave a session and reconnection step in the Subscribe to streams tutorial.
By default, any signals you send while your client is temporarily disconnected from a session are queued and sent when (and if) you successfully reconnect. You can use the Session.sendSignal(String type, String data, Connection connection, boolean retryAfterReconnect) method and set the retryAfterReconnect parameter to false to prevent signals from being queued while you are disconnected.
For more information, see Preventing signals from being sent during automatic reconnection.
When the connection is dropped and the client tries to reconnect, the OTSessionDelegate sessionDidBeginReconnecting(_:) message is sent to the OTSession object's delegate. When the connection is restored, the OTSessionDelegate sessionDidReconnect(_:) message is sent. If the client cannot restore the connection, the OTSessionDelegate sessionDidDisconnect(_:) message is sent.
In response to these events, your application can (optionally) display user interface notifications indicating the temporary disconnection, reconnection, and disconnection states.
When your client temporarily disconnects from a session, the OKSubscriberKitDelegate objects in clients subscribing to a stream you publish send messages when your published stream drops and when (and if) it resumes automatically.
For more information, see the Detecting when streams leave a session and reconnection step in the Subscribe to streams tutorial.
By default, any signals you send while your client is temporarily disconnected from a session are queued and sent when (and if) you successfully reconnect. You can use the OTSession signal(withType: string:connection:retryAfterReconnect:error:) method to prevent signals from being queued while you are disconnected.
For more information, see Signaling tutorial.
When the connection is dropped and the client tries to reconnect, the [OTSessionDelegate sessionDidBeginReconnecting:] message is sent to the OTSession object's delegate. When the connection is restored, the [OTSessionDelegate sessionDidReconnect:] message is sent. If the client cannot restore the connection, the [OTSessionDelegate sessionDidDisconnect:] message is sent.
In response to these events, your application can (optionally) display user interface notifications indicating the temporary disconnection, reconnection, and disconnection states.
When your client temporarily disconnects from a session, the OKSubscriberKitDelegate objects in clients subscribing to a stream you publish send messages when your published stream drops and when (and if) it resumes automatically. For more information, see the Detecting when streams leave a session and reconnection step in the Subscribe to streams tutorial.
By default, any signals you send while your client is temporarily disconnected from a session are queued and sent when (and if) you successfully reconnect. You can use the [OTSession signalWithType:string:connection:retryAfterReconnect:error:] method to prevent signals from being queued while you are disconnected. For more information, see Preventing signals from being sent during automatic reconnection.
When the connection is dropped and the client tries to reconnect, the Session.ReconnectionStart event is sent. When the connection is restored, the Session.ReconnectionSuccess event is sent. If the client cannot restore the connection, the client disconnects from the Vonage Video session, and the Session.Disconnected event is sent.
In response to these events, your application can (optionally) display user interface notifications indicating the temporary disconnection, reconnection, and disconnection states:
When your client temporarily disconnects from a session, Subscriber objects in clients subscribing to the stream send Subscriber.StreamDisconnected and Subscriber.StreamDisconnected events when your published stream drops and when (and if) it resumes automatically. For more information, see the Detecting when streams leave a session and reconnection step in the Subscribe to streams tutorial.
By default, any signals you send while your client is temporarily disconnected from a session are queued and sent when (and if) you successfully reconnect. You can use the Session.SendSignal(type, signal, connection, retryAfterReconnect) method and set the retryAfterReconnect parameter to false to prevent signals from being queued while you are disconnected. For more information, see Preventing signals from being sent during automatic reconnection.
When the connection is dropped and the client tries to reconnect, the on_reconnection_started callback function of the otc_session_callbacks struct is called. When the connection is restored, the on_reconnected callback function of the otc_session_callbacks struct is called.
If the client cannot restore the connection, the client disconnects from the OpenTok session, and the on_disconnected callback function of the otc_session_callbacks struct is called.
In response to these events, your application can (optionally) display user interface notifications indicating the temporary disconnection, reconnection, and disconnection states.
When another client temporarily disconnects from a session, the on_disconnected callback function of the otc_subscriber_callbacks struct for a subscriber to a stream published by that client is called. The on_reconnected callback function of the otc_subscriber_callbacks struct for the subscriber is invoked when (and if) the client reconnects and the stream resumes automatically.
For more information, see the Detecting when streams leave a session and reconnection step in the Subscribe to streams tutorial.
By default, any signals you send while your client is temporarily disconnected from a session are queued and sent when (and if) you successfully reconnect.
To prevent signals from being queued while you are disconnected. you can use the otc_session_send_signal_with_options() function or the otc_session_send_signal_to_connection_with_options () function and set the retryAfterReconnect member to false in the otc_signal_options you pass into the function.
For more information, see Preventing signals from being sent during automatic reconnection.