Join a session

First initialize a Session object:

var OV = new OpenVidu();
var session = OV.initSession();

Then by calling session.connect method you can join a properly initialized session.

// After retrieving a token from OpenVidu Server...
session.connect(token)
    .then( ... )
    .catch( ... );


You must ask OpenVidu Server for a user token. To do so:

  1. Initialize a Session in OpenVidu Server

  2. Generate a token for this session in OpenVidu Server

  3. Return this token to your client-side to use it on Session.connect()

You can add an optional second parameter to pass some user metadata that will be recieved by every other user connected to the same session (check Share data between users to learn more).

session.connect(token, DATA)
    .then( ... )
    .catch( ... );