Your Application might require to send instructions, data to one or more recipient connected in a Session to deploy new features, business workflow. For example, you want to create a Polling mechanism among participants. EnableX supports Custom Signaling method through which you can build such utility that requires passing of messages among participants.

Using Custom Signaling Method, you might send message to all or selected participants in a Room. You can define your custom data structure to pass to meet your business requirement.

MethodEnx.sendUserData(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.sendUserData(message, true, null); // Send to all
Enx.sendUserData(message, false, [ClientID]); // Send to few clients

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

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