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)
Parameters:
clientId
: Client ID of the user awaiting the Moderator’s approval.
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" } ]