Moderation — REST
Forcing a client endpoint to disconnect from a session
In addition to moderating connected client endpoints from the OpenTok.js SDK, app servers may issue an HTTP DELETE from the server side to force a connected client to disconnect from a session.
Your application server can disconnect a client from an OpenTok session by sending an HTTP DELETE request to the resource for that client's connection:
For more information, see the OpenTok REST API documentation.
Forcing streams in a session to mute published audio
You can use the OpenTok REST API to force a publisher of a specific stream to mute its published audio:
You can use the OpenTok REST API to force all streams (except for an optional list of streams) in a session to mute published audio:
The JSON data includes the following properties:
active(Boolean, required) — Whether to mute streams in the session (true) and enable the mute state of the session, or to disable the mute state of the session (false). With the mute state enabled (true), all current and future streams published to the session (with the exception of streams in theexcludedStreamIdsarray) are muted. When you call this method with theactiveproperty set tofalse, future streams published to the session are not muted (but any existing muted streams remain muted).excludedStreamIds(Array of strings, optional) — The stream IDs for streams that should not be muted. This is an optional property. If you omit this property, all streams in the session will be muted. This property only applies when theactiveproperty is set totrue. When theactiveproperty is set tofalse, it is ignored.
To disable the mute state of the session (to disable future streams from being muted),
call the method again with the active property set to false: