The EnxRoom.sendMessage() method is used to exchange messages between Session participants. It allows you to exchange the following types of messages:

  • Public Messaging: To send messages to all connected users.
  • Private Messaging: To send messages to a specific user.
  • Group Messaging: 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)


  • Message – String. Text message to be sent.
  • IsBroadcast – Boolean. Set to true for Public Messaging, false for Private Messaging.
  • RecipientIDs – Array of Client IDs to receive messages. Applicable for Group and Private Messaging.

Notification Event:

message-received – Receives event.message JSON Object at the Recipient Endpoint.

    "type": "message-received",
    "message": {
        "broadcast": false,
        "sender": "SENDER_NAME",
        "senderId": "XX",
        "type": "chat",
        "message": "TEXT MESSAGE",
        "timestamp": 99999,
        "receipients": [
            "XOXO", "XOXOXO"

To send & receive message

// To send message to all (Public Messaging)
room.sendMessage("Text Message", true, [], function(data){
    // Message sent

// To send to selected Participant (Private Messaging)
room.sendMessage("Text Message", false, ["XXXX"], function(data){
    // Message sent

// To receive message notification 
room.addEventListener("message-received", function (event) {
     var InMsg = event.message;
     if (InMsg.broadcast === true) {
         // Handle Public Message
     else {
         // Handle Message from InMsg.sender