This is an advance messaging feature between Session participants. You can do following type of messaging in a session among participants:

  • Public Messaging: To send message to all connected users.
  • Private Messaging: To send message to a specific user.
  • Group Messaging: To send message to more than one specified users.

Messaging feature neither require the sender to publish his Stream, nor receivers to subscribe.

MethodEnx.sendMessage(message, isBroadcast, clientIds)

Parameters:

  • message – String. type message.
  • IsBroadcast – Boolean. Use true for Public Broadcast, Use false for private messaging to one or more recipients.
  • clientIDs – Array of ClientIDs whom you wish to send private messages.

Callbacks: 

  • receiveChatDataAtRoom – Receives message in JSONObject
  • acknowledgeSendData – Sender is acknowledged
Enx.sendMessage(message, true, null); // Public Messaging
Enx.sendMessage(message, false, [ClientID]); // Private/Group Messaging

 
// Users Receive Message through Callback 
receiveChatDataAtRoom: event => {
      // event = 
      // { "source_id":"XXX", "type":"chat", "msg":"hello"} 
}  

// Sender is acknowledged  
acknowledgeSendData: event => {
     
}