Table of Contents
Lock / Unlock Room
The EnxRoom.lockRoom()
method allows the Moderator to lock the Room which forbids any new user from joining the Session. The Moderator can unlock the Room using EnxRoom.unLockRoom()
method to allow subsequent users to join the Session.
Class: EnxRoom
Methods:
-
public void lockRoom()
– No Parameter required. -
public void unLockRoom()
– No Parameter required.
Callbacks:
onAckLockRoom -
Acknowledgment to the Moderator when the Room is locked.onLockedRoom -
Notification to all the participants in the Room when the room is locked.onAckUnLockRoom -
Acknowledgment to the Moderator when the Room is unlocked.onUnLockedRoom -
Notification to all the participants in the Room when the room is unlocked.
room.lockRoom(); // Moderator is acknowledged that room has been locked public void onAckLockRoom(JSONObject jsonObject) { // Handle JSONObject } // Participants are notified that room has been locked public void onLockedRoom(JSONObject jsonObject) { // Handle JSONObject } room.unLockRoom(); // Moderator is acknowledged that room has been unlocked public void onAckUnLockRoom(JSONObject jsonObject) { // Handle JSONObject } // Participants are notified that room has been unlocked public void onUnLockedRoom(JSONObject jsonObject) { // Handle JSONObject }
Error Codes & Exceptions
Code | Description |
---|---|
5115 | Unauthorized Access. When a user with participant role invokes lockRoom() or unlockRoom() . |
5117 | Invalid request. When the Moderator invokes lockRoom() on a locked Room. |
5118 | Invalid request. When the Moderator invokes un on an unlocked Room. |
Moderate Participant’s entry to a Session
In a knock-enabled Room, a user needs to wait until the Moderator grants them permission to join the Session. The EnxRoom.approveAwaitedUser()
method allows the Moderator to approve a user’s entry and EnxRoom.denyAwaitedUser()
method is used to decline a user’s entry to the Session.
Methods:
EnxRoom.approveAwaitedUser(ClientID, Callback)
EnxRoom.denyAwaitedUser(ClientID, Callback)
Event Notifications:
user-awaited
– Notification to the Moderator when a user awaits their permission to join Room.room-allowed
– Notification to the user when the user is permitted to join Room after waiting on a wait-for-moderator or knock-enabled Room.
// Moderator is notified about awaited user room.addEventListener("user-awaited", function(event, user) { // Client Info: user.clientId // Create UI for Moderator Interaction to allow or deny // To allow room.approveAwaitedUser(clientId, function(success, error) { // Check Success / Error result }); // To deny /* room.approveAwaitedUser(clientId", function(success, error) { // Check Success / Error result }); */ });
To manage awaited users when moderator joins late
If the Moderator joins after the participant(s) have sent a request to join the Session in a Knock-enabled Room, then the Moderator can get the list of participants awaiting approval using room.awaitedParticipants
. You can utilize this attribute to build UI for Moderator controls to handle pending approvals.
// e.g. room.awaitedParticipants [ { "clientId”: "String", "name": "String" } ]