The Connection object represents a connection to a TokBox session.
The Session object has a connection property that is a Connection object.
It represents the local user's connection.
The Stream object has a connection property that is a Connection object.
It represents the stream publisher's connection.
To initialize a session, call the TB.initSession() method, which
returns the Session object. Then call the connect() method of the
Session object to connect to a session. The Session object dispatches a
sessionConnected event when the connection is made. For a code
example, see SessionConnectEvent.
The Connection object has the following properties:
connectionId (String) The ID of this connection.
creationTime (Number) The timestamp for the creation
of the connection. This value is calculated in milliseconds. You can convert this value to a
Date object by calling new Date(creationTime), where creationTime is the
creationTime property of the Connection object.
data (String) A string containing metadata describing the
connection. When you generate a user token string pass the connection data string to the
generate_token() method of the
OpenTok
server-side libraries. You can also generate a token and define connection data on the
Dashboard page.
quality Includes information about the downstream bandwidth, the upstream bandwidth, and the latency of the connection at the time the connection is established. This information can help you to handle different network conditions (such as connections from mobile devices and on other low-bandwidth connections).
The quality object includes the following properties:
The quality property is set only if you set the detectConnectionQuality
property to 1 in the object you pass as the properties parameter of the connect()
method of the Session object.