close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal



The Connection object represents a connection to an OpenTok session. Each client that connects to a session has a unique connection, with a unique connection ID (represented by the id property of the Connection object for the client).

The Session object has a connection property that is a Connection object. It represents the local client's connection. (A client only has a connection once the client has successfully called the connect() method of the Session object.)

The Session object dispatches a connectionCreated event when each client (including your own) connects to a session (and for clients that are present in the session when you connect). The connectionCreated event object has a connection property, which is a Connection object corresponding to the client the event pertains to.

The Stream object has a connection property that is a Connection object. It represents the connection of the client that is publishing the stream.


Name Type Description
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, you can define connection data (see the Token creation overview).