Create a session

You must get an OpenVidu object and call initSession method. This must receive just one string parameter: the sessionID, which unambiguously identify your session:

  • If you have a server-side, you should ask for the sessionId to OpenVidu Server (thanks to the REST API, openvidu-java-client or openvidu-node-client) and return it to the client to use it on initSession method.

  • If you don't have a server side, you willl have to build sessionId param by yourself with the following format (this is not recommended for production as the secret must be hardcoded in your JavaScript code):

"wss://" + OPENVIDU_IP + ":8443/" + SESSION_IDENTIFIER + "?secret=" + OPENVIDU_SECRET

// Get sessionId by asking OpenVidu Server from your application server
// and then returning it here or generate it by your own with the format above

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