{"id":4032,"date":"2021-11-02T19:15:28","date_gmt":"2021-11-02T11:15:28","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4032"},"modified":"2022-04-08T15:51:08","modified_gmt":"2022-04-08T07:51:08","slug":"chat","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/web-toolkit\/chat\/","title":{"rendered":"Chat: Web SDK &#8211; Video API"},"content":{"rendered":"\n<p>The&nbsp;<code>EnxRoom.sendMessage()<\/code>&nbsp;method is used to exchange messages between Session participants. It allows you to exchange the following types of messages:<\/p>\n\n\n\n<ul><li><strong>Public Messaging:&nbsp;<\/strong>To send messages to all connected users.<\/li><li><strong>Private Messaging:&nbsp;<\/strong>To send messages to a specific user.<\/li><li><strong>Group Messaging:<\/strong>&nbsp;To send messages to more than one user.<\/li><\/ul>\n\n\n\n<p>The Messaging feature does not require the sender to publish Local Stream or the receiver to subscribe to Remote Stream.<\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>EnxRoom.sendMessage(Message, IsBroadcast, RecipientIDs, Callback)<\/code><\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ul><li><code>Message<\/code> &#8211; String. Text message to be sent.<\/li><li><code>IsBroadcast<\/code> &#8211; Boolean. Set to&nbsp;<em>true&nbsp;<\/em>for Public Messaging,&nbsp;<em>false&nbsp;<\/em>for Private Messaging.<\/li><li><code>RecipientIDs<\/code> &#8211; Array of Client IDs to receive messages. Applicable for Group and Private Messaging.<\/li><\/ul>\n\n\n\n<p><strong>Notification Event: <\/strong><\/p>\n\n\n\n<p><code>message-received<\/code> &#8211; Receives <code>event.message<\/code> JSON Object at the Recipient Endpoint.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{\n    \"type\": \"message-received\",\n    \"message\": {\n        \"broadcast\": false,\n        \"sender\": \"SENDER_NAME\",\n        \"senderId\": \"XX\",\n        \"type\": \"chat\",\n        \"message\": \"TEXT MESSAGE\",\n        \"timestamp\": 99999,\n        \"receipients\": [\n            \"XOXO\", \"XOXOXO\"\n        ]\n    }\n}<\/pre>\n\n\n\n<p><strong>To send &amp; receive message<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ To send message to all (Public Messaging)\nroom.sendMessage(\"Text Message\", true, [], function(data){\n    \/\/ Message sent\n});\n\n\/\/ To send to selected Participant (Private Messaging)\nroom.sendMessage(\"Text Message\", false, [\"XXXX\"], function(data){\n    \/\/ Message sent\n});\n\n\/\/ To receive message notification \nroom.addEventListener(\"message-received\", function (event) {\n     var InMsg = event.message;\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=\"..\/stream-information\/\">Know Your Stream<\/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=\"..\/custom-signalling\/\">Custom Signalling<\/a>  \u2192 <\/p>\n<\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The&nbsp;EnxRoom.sendMessage()&nbsp;method is used to exchange messages between Session participants. It allows you to exchange the following types of messages: Public Messaging:&nbsp;To send messages to all connected users. Private Messaging:&nbsp;To send messages to a specific user. Group Messaging:&nbsp;To send messages to more than one user. The Messaging feature does not require the sender to publish Local Stream or the receiver to subscribe to Remote Stream. Method: EnxRoom.sendMessage(Message, IsBroadcast, RecipientIDs, Callback) Parameters:&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&nbsp;EnxRoom.sendMessage()&nbsp;method is used to exchange messages between Session participants. It allows you to exchange the following types of messages: Public Messaging:&nbsp;To send messages to all connected users. Private Messaging:&nbsp;To send messages to a specific user. Group Messaging:&nbsp;To send messages to more than one user. The Messaging feature does not require the sender to publish Local&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4032"}],"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=4032"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4032\/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=4032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}