OTSessionDelegate Protocol Reference
Conforms to | NSObject |
---|---|
Declared in | OTSession.h |
Overview
Used to send messages for an OTSession instance. The OTSession class
includes a
delegate
property. When you send the
[OTSession initWithApiKey:sessionId:delegate:] message,
you specify an OTSessionDelegate object.
Connecting to a session
– sessionDidConnect:
required method
Sent when the client connects to the session.
- (void)sessionDidConnect:(OTSession *)session
Parameters
session |
The OTSession instance that sent this message. |
---|
Declared In
OTSession.h
– sessionDidDisconnect:
required method
Sent when the client disconnects from the session.
- (void)sessionDidDisconnect:(OTSession *)session
Parameters
session |
The OTSession instance that sent this message. |
---|
Declared In
OTSession.h
– session:didFailWithError:
required method
Sent if the session fails to connect, some time after your application invokes [OTSession connectWithToken:].
- (void)session:(OTSession *)session didFailWithError:(OTError *)error
Parameters
session |
The OTSession instance that sent this message. |
---|---|
error |
An OTError object describing the issue. The
|
Declared In
OTSession.h
Monitoring streams in a session
– session:streamCreated:
required method
Sent when a new stream is created in this session.
- (void)session:(OTSession *)session streamCreated:(OTStream *)stream
Parameters
session |
The OTSession instance that sent this message. |
---|---|
stream |
The stream associated with this event. |
Discussion
Note that if your application publishes to this session, your own session delegate will not receive the [OTSessionDelegate session:streamCreated:] message for its own published stream. For that event, see the delegate callback [OTPublisherKit publisher:streamCreated:].
Declared In
OTSession.h
– session:streamDestroyed:
required method
Sent when a stream is no longer published to the session.
- (void)session:(OTSession *)session streamDestroyed:(OTStream *)stream
Parameters
session |
The OTSession instance that sent this message. |
---|---|
stream |
The stream associated with this event. |
Declared In
OTSession.h
Monitoring connections in a session
– session:connectionCreated:
Sent when another client connects to the session. The connection
object
represents the client’s connection.
- (void)session:(OTSession *)session connectionCreated:(OTConnection *)connection
Parameters
session |
The OTSession instance that sent this message. |
---|---|
connection |
The new OTConnection object. |
Discussion
This message is not sent when your own client connects to the session. Instead, the [OTSessionDelegate sessionDidConnect:] message is sent when your own client connects to the session.
Declared In
OTSession.h
– session:connectionDestroyed:
Sent when another client disconnects from the session. The connection
object represents the connection that the client had to the session.
- (void)session:(OTSession *)session connectionDestroyed:(OTConnection *)connection
Parameters
session |
The OTSession instance that sent this message. |
---|---|
connection |
The OTConnection object for the client that disconnected from the session. |
Discussion
This message is not sent when your own client disconnects from the session. Instead, the [OTSessionDelegate sessionDidDisconnect:] message is sent when your own client connects to the session.
Declared In
OTSession.h
– session:receivedSignalType:fromConnection:withString:
Sent when a message is received in the session.
- (void)session:(OTSession *)session receivedSignalType:(NSString *)type fromConnection:(OTConnection *)connection withString:(NSString *)string
Parameters
session |
The OTSession instance that sent this message. |
---|---|
type |
The type string of the signal. |
connection |
The connection identifying the client that sent the message. |
string |
The signal data. |
Declared In
OTSession.h
Monitoring archiving events
– session:archiveStartedWithId:name:
Sent when an archive recording of a session starts. If you connect to a session in which recording is already in progress, this message is sent when you connect.
- (void)session:(OTSession *)session archiveStartedWithId:(NSString *)archiveId name:(NSString *)name
Parameters
session |
The OTSession instance that sent this message. |
---|---|
archiveId |
The unique ID of the archive. |
name |
The name of the archive (if one was provided when the archive was created). |
Discussion
In response to this message, you may want to add a user interface notification (such as an icon in the Publisher view) that indicates that the session is being recorded.
For more information see the OpenTok Archiving Overview.
Declared In
OTSession.h
– session:archiveStoppedWithId:
Sent when an archive recording of a session stops.
- (void)session:(OTSession *)session archiveStoppedWithId:(NSString *)archiveId
Parameters
session |
The OTSession instance that sent this message. |
---|---|
archiveId |
The unique ID of the archive. |
Discussion
In response to this message, you may want to change or remove a user interface notification (such as an icon in the Publisher view) that indicates that the session is being recorded.
For more information, see the OpenTok Archiving Overview.
Declared In
OTSession.h
Reconnecting to a session
– sessionDidBeginReconnecting:
Sent when the local client has lost its connection to an OpenTok session and is trying to reconnect. This results from a loss in network connectivity. If the client can reconnect to the session, the [OTSessionDelegate sessionDidReconnect:] message is sent. Otherwise, if the client cannot reconnect, the [OTSessionDelegate sessionDidDisconnect:] message is sent.
- (void)sessionDidBeginReconnecting:(OTSession *)session
Parameters
session |
The OTSession instance that sent this message. |
---|
Discussion
In response to this message being sent, you may want to provide a user interface notification, to let the user know that the app is trying to reconnect to the session and that audio-video streams are temporarily disconnected.
This method is part of the automatic reconnection beta feature. To participate in the beta program, see the OpenTok Beta programs page.
Declared In
OTSession.h
– sessionDidReconnect:
Sent when the local client has reconnected to the OpenTok session after its
network connection was lost temporarily. When the connection is lost, the
[OTSessionDelegate sessionDidBeginReconnecting:] message is sent, prior to
the [OTSessionDelegate sessionDidReconnect:]
messsage.
If the client cannot reconnect to the session, the
[OTSessionDelegate sessionDidDisconnect:] message is sent.
- (void)sessionDidReconnect:(OTSession *)session
Parameters
session |
The OTSession instance that sent this message. |
---|
Discussion
Any existing publishers and subscribers are automatically reconnected when the client reconnects and this message is sent.
By default, any signals initiated by the the local client using the
[OTSession signalWithType:string:connection:error:] method are sent when
the client reconnects. To prevent any signals initiated while disconnected
from being sent, use the
[OTSession signalWithType:string:connection:retryAfterReconnect:error:]
method to send the signal, and set the retryAfterReconnect
parameter to NO
. (All signals sent by other clients while your
client was disconnected are received upon reconnecting.)
This method is part of the automatic reconnection beta feature. To participate in the beta program, see the OpenTok Beta programs page.
Declared In
OTSession.h