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:
public void approveAwaitedUser(String clientId)
public void denyAwaitedUser(String clientId)
Callbacks:
onUserAwaited
– Notification to the Moderator when a user awaits their permission to join Room.onRoomAwaited
– Notification to the user when they await Moderator’s permission to join Room with { “event_type”: “knock” } in the JSON Payload.onAckForApproveAwaitedUser
– Acknowledgment to the Moderator when the user is granted permission to join Room.onRoomConnected
– Notification to the user when the user is permitted to join Room.-
onAckForDenyAwaitedUser
– Acknowledgment to the Moderator when the user is denied permission to join Room. onRoomDisconnected
– Notification to the user along with a reason for denial when the user is denied access to the Room.
// Moderator is notified about awaited user public void onUserAwaited(JSONObject jsonObject) { // Awaited Client Info in the jsonObject, e.g. // {"id","String", "name": "String”} enxRoom.approveAwaitedUser(jsonObject.id); // To allow user to join room enxRoom.denyAwaitedUser(jsonObject.id); // To deny user }; public void onAckForApproveAwaitedUser(JSONObject jsonObject) { // User has been allowed entry } public void onAckForDenyAwaitedUser(JSONObject jsonObject) { // User has been denied entry }
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" } ]