{"id":4557,"date":"2021-11-29T17:17:17","date_gmt":"2021-11-29T09:17:17","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4557"},"modified":"2025-02-20T20:27:48","modified_gmt":"2025-02-20T12:27:48","slug":"send-chat-data","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/react-native-toolkit\/send-chat-data\/","title":{"rendered":"Send Chat Data: React Native SDK &#8211; Video API"},"content":{"rendered":"\n<p class=\"has-vivid-red-color has-text-color\"><strong>INFO!\u00a0<\/strong>Android Toolkit 1.4.2 support an advance version of\u00a0<a href=\"#messaging\">Public &amp; Private Messaging API<\/a>. Therefore, you are discouraged to use this Stream based Messaging. It will be deprecated in future version. <\/p>\n\n\n\n<p>You may implement basic text-chat communication using Video API. The Text-Data is carried on a separate data track in a published Stream and received by all subscribers of the stream.<\/p>\n\n\n\n<ul><li><strong>Notes to send message<\/strong>:<ul><li>You must initiate your stream with data track enabled using the JSON Payload as <code>{data: true}<\/code> <\/li><li>You must publish your stream into the room before you can use the <code>Enx.sendData() <\/code>method. <\/li><\/ul><\/li><li><strong>Notes to receive message<\/strong>:<ul><li>You must subscribe to the remote stream <\/li><li>User Observer <code>receiveData<\/code> to receive any incoming message. <\/li><\/ul><\/li><\/ul>\n\n\n\n<p><strong>Method<\/strong>: <code>Enx.sendData(localStreamId, messageObject)<\/code> <\/p>\n\n\n\n<p><strong>Parameter<\/strong>:  <\/p>\n\n\n\n<ul><li><code>localStreamId <\/code>&#8211; Local Stream ID on which the message to be sent<\/li><li><code>messageObject<\/code>&#8211; This object has following keys:<ul><li><code>from<\/code>: Sender Name<\/li><li><code>message<\/code>: Message Body<\/li><li><code>timestamp<\/code>: Time Stamp in UTC \u2013 when the message was originated<\/li><\/ul><\/li><\/ul>\n\n\n\n<p><strong>Callback<\/strong>: <code>receiveData<\/code> &#8211; To all participants in the room with messageObject<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">messageJSON:&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message:&nbsp;\"Test&nbsp;chat\",\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from:&nbsp;\"React-Native\",\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;timestamp:&nbsp;Date.now()\n}\n\n\nEnx.sendData(localStreamId, messageJSON);  \/\/ Send message\n\n\/\/ Participants receive message\nreceiveData : event=&gt;{\n\t\/* event = \n\t{\tid : 12345, \n\t\tmsg : {\n\t\t\tfrom: \"\", message: \"\", \n\t\t\ttimestamp: 12345, type: \"public\"\n\t\t}\n\t} *\/\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=\"..\/room-information\/\">Room Information<\/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=\"..\/chat\/\">Send Message<\/a> \u2192<a href=\"\/developer\/how-to-use\/\"><\/a><\/p>\n<\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>INFO!\u00a0Android Toolkit 1.4.2 support an advance version of\u00a0Public &amp; Private Messaging API. Therefore, you are discouraged to use this Stream based Messaging. It will be deprecated in future version. You may implement basic text-chat communication using Video API. The Text-Data is carried on a separate data track in a published Stream and received by all subscribers of the stream. Notes to send message: You must initiate your stream with data&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3747,"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":"INFO!\u00a0Android Toolkit 1.4.2 support an advance version of\u00a0Public &amp; Private Messaging API. Therefore, you are discouraged to use this Stream based Messaging. It will be deprecated in future version. You may implement basic text-chat communication using Video API. The Text-Data is carried on a separate data track in a published Stream and received by all&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4557"}],"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=4557"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4557\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/3747"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=4557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}