The EnxRoom.dropUser() method allows the Moderator to disconnect / force-drop one or more participant(s) from the Session.

Class: EnxRoom

Method: EnxRoom.dropUser(ClientIds, Callback)

Parameters:

  • ClientId – Required. Array of Client Ids to be disconnected. You can also pass an empty array “[]” to disconnect all the users.
  • Callback – A JSON received with status of API call.

Event Notification: 

room-disconnected – Notification to the affected user with the reason to be disconnected from the Room.

// To disconnect specified user
room.dropUser([ClientId], function(res) {
    if (res.result == 0) {
        // Request processed 
    }
});

// To disconnect all usuers. pass empty Array
room.dropUser([], function(res) {
    if (res.result == 0) {
        // Request processed 
    }
});

// All users are notified disconnection with reason
room.addEventListener("room-disconnected", function(event) {
	// Event may be processed to know reason
	if (event.message.cause.msg === 'disconnected-by-moderator')	{
		// Show message to user
	}
});