Sessions


A session connects two or more users so that they can communicate over video, audio, chat, and other available methods. Sessions are spun up on demand and do not need to be scheduled. Up to 1,000 participants can be in a session. A participant can be in one session (per browser tab) at a time. Sessions are scoped to your Video SDK account.

On this page

Prerequisites

Here are the parameters for the client.join() function.

ParameterParameter Description
topicRequired, a session name of your choice or the name of the session you are joining.
tokenRequired, your Video SDK JWT.
userNameRequired, a name for the participant.
passwordRequired, a session passcode of your choice or the passcode of the session you are joining.
sessionIdleTimeoutMinsOptional, the number of minutes your session can idle before ending.

Start session

To start a session, call the client.join() function. Pass in a session name, Video SDK JWT, participant name, and a session passcode. To specify the host of the session, pass role 1 into the Video SDK JWT.

After a session is successfully started, define the stream, which will be used to for core features.

client.join(topic, token, userName, password).then(() => {
stream = client.getMediaStream()
}).catch((error) => {
console.log(error)
})

Join session

To join a session, call the same client.join() function. Pass in the session name, Video SDK JWT, participant name, and the session passcode. To specify participants of the session, pass role 0 into the Video SDK JWT.

After a session is successfully started, define the stream, which will be used to for core features.

client.join(topic, token, userName, password).then(() => {
stream = client.getMediaStream()
}).catch((error) => {
console.log(error)
})

Leave Session

To leave a session, call the client.leave() function. When the last participant leaves, the session will end.

client.leave()

End session

To end a session, call the client.leave() function and pass in true. Only the host can end a session with participants present.

client.leave(true)

For the full set of session features, see the Video SDK Reference.

Now that we are in a session, we can start using core features.

Need help?

If you're looking for help, try Developer Support or our Developer Forum. Priority support is also available with Premier Developer Support plans.