How can I end a session for all participants?
Ending a session for all participants.
- Video API
An Opentok session cannot be destroyed, but it is possible to disconnect clients from it and prevent them from rejoining.
A Publisher with a token that has a “Moderator” role assigned can force any user to disconnect from a session.
To do so, the Moderator calls the forceDisconnect() method of the Session object, passing in the Connection object for the client you want to disconnect:
In order to prevent rejoining a session, you can generate a token that has a short lifespan. Once the client that got disconnected from a session (and has an expired token) cannot rejoin the session.
Note, that even when a token is expired, a client will stay connected to a session until gets disconnected (either by calling forceDisconnect() or on its own).
Please sign in to leave a comment.