{"id":4131,"date":"2021-11-09T14:26:36","date_gmt":"2021-11-09T06:26:36","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4131"},"modified":"2022-04-08T13:55:40","modified_gmt":"2022-04-08T05:55:40","slug":"room-entry-restriction","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/web-toolkit\/room-entry-restriction\/","title":{"rendered":"Room Entry Restriction: Web SDK &#8211; Video API"},"content":{"rendered":"\n<h4>Table of Contents<\/h4>\n\n\n\n<ul><li><a href=\"#lock-unlock-room\">Lock \/ Unlock Room<\/a><\/li><li><a href=\"#allow-deny-room-entry\">Moderate Participant Entry to Session<\/a><\/li><li><a href=\"#wait-for-moderator\">Wait-For-Moderator Rooms<\/a><\/li><\/ul>\n\n\n\n<a name=\"lock-unlock-room\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2>Lock \/ Unlock Room<\/h2>\n\n\n\n<p>The&nbsp;<code>EnxRoom.lock()<\/code>&nbsp;method allows the Moderator to lock the Room which forbids any new user from joining the Session. The Moderator can unlock the Room using&nbsp;<code>EnxRoom.unLock()<\/code>&nbsp;method to allow subsequent users to join the Session.<\/p>\n\n\n\n<p><strong>Class:<\/strong> <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Methods:<\/strong><\/p>\n\n\n\n<ul><li><code>EnxRoom.lock()<\/code><\/li><li><code>EnxRoom.unlock()<\/code>&nbsp;<\/li><\/ul>\n\n\n\n<p><strong>Event Notifications:<\/strong><\/p>\n\n\n\n<ul><li><code>room-locked<\/code> &#8211;&nbsp;Notification to all the participants in the Room along with the responsible Moderator ID when the room is locked. <\/li><li><code>room-unlocked<\/code> &#8211;&nbsp;Notification to all the participants in the Room along with the responsible Moderator ID when the room is unlocked. <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">room.lock();\n\n\/\/ Participants are notified that room has been locked\nroom.addEventListener('room-locked', function(event) {             \t \n});  \n\nroom.unlock();\n\n\/\/ Participants are notified that room has been unlocked\nroom.addEventListener('room-locked', function(event) {              \n});<\/pre>\n\n\n\n<p><strong>Error Codes \/ Exceptions<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Code<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>4101<\/td><td>Unauthorized Access. When a user with <code>participant<\/code> role calls <code>lockRoom()<\/code> or <code>unlockRoom()<\/code><\/td><\/tr><tr><td>4121<\/td><td>Retrying to lock\/unlock Room already in the requested state.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<a name=\"allow-deny-room-entry\"><\/a>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2>Moderate Participants&#8217; entry to a Session<\/h2>\n\n\n\n<p>In a&nbsp;<a href=\"..\/..\/..\/server-api\/rooms-route\/#create-room\" target=\"_blank\" rel=\"noreferrer noopener\">knock-enabled Room,<\/a>&nbsp;a user needs to wait until the Moderator grants them permission to join the Session. The&nbsp;<code>EnxRoom.approveAwaitedUser()<\/code>&nbsp;method allows the Moderator to approve a user\u2019s entry and&nbsp;<code>EnxRoom.denyAwaitedUser()<\/code>&nbsp;method is used to decline a user\u2019s entry to the Session.<\/p>\n\n\n\n<p><strong>Methods: <\/strong><\/p>\n\n\n\n<ul><li><code>EnxRoom.approveAwaitedUser(ClientID, Callback)<\/code> <\/li><li><code>EnxRoom.denyAwaitedUser(ClientID, Callback)<\/code> <\/li><\/ul>\n\n\n\n<p><strong>Event Notifications:<\/strong><\/p>\n\n\n\n<ul><li><code>user-awaited<\/code> &#8211; Notification to the Moderator when a user awaits their permission to join Room.<\/li><li><code>room-allowed<\/code> &#8211; Notification to the user when the user is permitted to join Room after waiting on a wait-for-moderator or knock-enabled Room.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ Moderator is notified about awaited user\nroom.addEventListener(\"user-awaited\", function(event, user) {\n      \/\/ Client Info: user.clientId\n      \/\/ Create UI for Moderator Interaction to allow or deny \n\n\t\/\/ To allow\n\troom.approveAwaitedUser(clientId, function(success, error) {\n\t     \/\/ Check Success \/ Error result\n\t});\n\n\t\/\/ To deny\n\t\/*\n\troom.approveAwaitedUser(clientId\", function(success, error) {\n\t     \/\/ Check Success \/ Error result\n\t});\n\t*\/\n});\n<\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>To manage awaited users when moderator joins late<\/h4>\n\n\n\n<p>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&nbsp;<code>room.awaitedParticipants<\/code>. You can utilize this attribute to build UI for Moderator controls to handle pending approvals.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ e.g. room.awaitedParticipants\n\n[\n\t{\t\"clientId\u201d: \"String\", \n\t\t\"name\": \"String\" \n\t}\n]\n<\/pre>\n\n\n\n<a name=\"wait-for-moderator\"><\/a>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2>Wait-for-Moderator Rooms<\/h2>\n\n\n\n<p>The Wait-For-Moderator Rooms restrict Participants from joining a session till the Moderator has joined the session. This is achieved by enabling <code>settings.wait_for_moderator:true<\/code> while <a href=\"\/developer\/video-api\/server-api\/rooms-route\/\">Creating a Room<\/a>. Once a Moderator joins, all awaited participants will automatically join the Session. All subsequent participants can join the session directly without having to wait once the Moderator is in the session.<\/p>\n\n\n\n<p>Participants <a href=\"..\/room-connection\/#connect-room\">connecting to room<\/a> do not receive <code>room-connected<\/code> event till the Moderator has joined the session. They get connected to the room with <code>room.waitRoom:true<\/code>. This event can be used to send a message or display a waiting lobby for the joining user.  <\/p>\n\n\n\n<p><strong>Event Notifications:<\/strong><\/p>\n\n\n\n<ul><li><code>room-allowed:<\/code>&nbsp;Notification to the Participant shortly after the Moderator joins the session and they are also directed to the session subsequently. <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ Participant are notified that Moderator is in\nroom.addEventListener(\"room-allowed\", function(event) {\n       \/\/ Show a message or move him out of Lobby\n});\n<\/pre>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<p> \u2190  <a href=\"..\/hard-muting\/\">Hard-muting<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column\">\n<p class=\"has-text-align-center\"> <a href=\"..\/\">Index<\/a> <\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column\">\n<p class=\"has-text-align-right\"><a href=\"..\/disconnect-user\/\"><\/a><a href=\"..\/disconnect-user\/\">Disconnect User<\/a> \u2192 <\/p>\n<\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Table of Contents Lock \/ Unlock Room Moderate Participant Entry to Session Wait-For-Moderator Rooms Lock \/ Unlock Room The&nbsp;EnxRoom.lock()&nbsp;method allows the Moderator to lock the Room which forbids any new user from joining the Session. The Moderator can unlock the Room using&nbsp;EnxRoom.unLock()&nbsp;method to allow subsequent users to join the Session. Class: EnxRoom Methods: EnxRoom.lock() EnxRoom.unlock()&nbsp; Event Notifications: room-locked &#8211;&nbsp;Notification to all the participants in the Room along with the responsible&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3724,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ub_ctt_via":""},"featured_image_src":null,"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"featured":false,"featured-large":false},"uagb_author_info":{"display_name":"vcxdevwpadmin","author_link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/author\/vcxdevwpadmin\/"},"uagb_comment_info":0,"uagb_excerpt":"Table of Contents Lock \/ Unlock Room Moderate Participant Entry to Session Wait-For-Moderator Rooms Lock \/ Unlock Room The&nbsp;EnxRoom.lock()&nbsp;method allows the Moderator to lock the Room which forbids any new user from joining the Session. The Moderator can unlock the Room using&nbsp;EnxRoom.unLock()&nbsp;method to allow subsequent users to join the Session. Class: EnxRoom Methods: EnxRoom.lock() EnxRoom.unlock()&nbsp;&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4131"}],"collection":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/comments?post=4131"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4131\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/3724"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=4131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}