{"id":4054,"date":"2021-11-03T16:56:11","date_gmt":"2021-11-03T08:56:11","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4054"},"modified":"2025-02-24T18:22:46","modified_gmt":"2025-02-24T10:22:46","slug":"custom-signalling","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/web-toolkit\/custom-signalling\/","title":{"rendered":"Custom Signalling: Web SDK &#8211; Video SDK"},"content":{"rendered":"\n<p>The\u00a0<code>EnxRoom.sendUserData()<\/code>\u00a0method allows you to send customized data adhering to a structure not bound by the portal message structure, to one or more users connected in a session. This allows your application to send not just messages but also structured instructions, polls, or any data that requires a customized data structure as per your business requirement.<\/p>\n\n\n\n<p><strong>Class:<\/strong> <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method: <\/strong><code>EnxRoom.sendUserData(MessageOpt, IsBroadcast, RecipientIDs, Callback)<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>:<\/p>\n\n\n\n<ul><li><code>MessageOpt<\/code> \u2013 JSON Object containing custom keys. This object is passed to the Recipients without any structure enforcement. Be advised to define keys effectively for signaling needs.<\/li><li><code>IsBroadcast<\/code> \u2013 <code>Boolean<\/code>. Set to&nbsp;<em>true&nbsp;<\/em>for Public Broadcast and&nbsp;<em>false&nbsp;<\/em>for signaling to one or more recipients.<\/li><li><code>RecipientIDs<\/code> \u2013 Array of Client IDs of recipients of the message when not broadcasting.<\/li><\/ul>\n\n\n\n<p><strong>Notification Event: <\/strong><\/p>\n\n\n\n<p><code>user-data-received<\/code> \u2013 Receives signaling in <code>MessageOpt<\/code> JSONObject as <code>event.message.msg<\/code>.<\/p>\n\n\n\n<p><strong>MessageOpt Sample JSON<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ Example: Important Information you can put with custom keys\n\nvar MessageOpt = {\n    \"broadcast\": false,                \/\/ Flag for Private message\n    \"sender\": \"Sender's Name\",\n    \"senderId\": \"Sender's Client ID\",  \/\/ room.clientId \n    \"message\": \"Message body\",\n    \"timestamp\": \"Date Timestamp\",     \/\/ Message sent at\n}<\/pre>\n\n\n\n<p><strong>To send &amp; receive Custom Signaling<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ To send custom data \/ signal to all (Public Messaging)\nroom.sendUserData(MessageOpt, true, [], function(data){\n    \/\/ Message sent\n});\n\n\/\/ To send custom data \/ signal to selected Participant (Private Messaging)\nroom.sendUserData(MessageOpt, false, [Recipient_ClientIds], function(data){\n    \/\/ Message sent\n});\n\n\/\/ To receive  custom data \/ signal notification \nroom.addEventListener(\"user-data-received\", function (event) {\n     var InMsg = event.message.msg;\n     if (InMsg.broadcast === true) {\n         \/\/ Handle Public Message\n     }\n     else {\n         \/\/ Handle Message from InMsg.sender\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=\"..\/chat\/\">Send Message<\/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=\"..\/file-share\/\">File Share<\/a>  \u2192 <\/p>\n<\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The\u00a0EnxRoom.sendUserData()\u00a0method allows you to send customized data adhering to a structure not bound by the portal message structure, to one or more users connected in a session. This allows your application to send not just messages but also structured instructions, polls, or any data that requires a customized data structure as per your business requirement. Class: EnxRoom Method: EnxRoom.sendUserData(MessageOpt, IsBroadcast, RecipientIDs, Callback) Parameters: MessageOpt \u2013 JSON Object containing custom keys.&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":"The\u00a0EnxRoom.sendUserData()\u00a0method allows you to send customized data adhering to a structure not bound by the portal message structure, to one or more users connected in a session. This allows your application to send not just messages but also structured instructions, polls, or any data that requires a customized data structure as per your business requirement.&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4054"}],"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=4054"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4054\/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=4054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}