Connecting to a session

Once you have a session ID, and initialized a session object using it, the next step is to connect to the session.

Learn how to connect to sessions below by selecting your platform/language of choice:

Call the connect() method, passing in a token and a completion handler function:

An error object is passed into the completion handler of the connect event when the client fails to connect to the session. Otherwise, no error object is passed in, indicating that the client connected successfully to the session.

The Session object also dispatches a sessionConnected event when the client connects to the session. And the OT object dispatches an exception event when there is an error in connecting. However, it is simpler to check for success in connecting by passing a completion handler into the connect() method, as the last parameter.