SessionConnection class

The SessionConnection object represents a Session object's connection to a TokBox session. It extends the Connection class. The connection property of a Stream object is of type Connection.

The SessionConnection property adds the quality property, which reports the downstream bandwith, the upstream bandwidth, and the latency of the local 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.

SessionConnection properties

The SessionConnection 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.

quality (ConnectionQuality) — 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 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.

IRC Live Chat

Have a quick question? Chat with TokBox Support on IRC. Join chat