This is an advance messaging feature between Session participants. You can conduct the following types of messaging in a session among participants:
- 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.
Messaging feature requires neither the sender to publish his Stream nor receivers to subscribe.
Method: sendMessage( message, isBroadcast, recipientIDs )
Parameters:
@param Strings message– String type message.@param bool isBroadcast– Boolean. Use true for Public Broadcast, false for private messaging to one or more recipients.@param List recipientIDs– Array of ClientIDs whom you wish to send private messages.
Event Listeners:
onAcknowledgedSendData– It notifies when the message is successfully sent to another user or group of usersonMessageReceived– It notifies at receiver’s end that a new message arrived
// To send message
message = “hi”;
var broadcast = true; // Incase of public messaging
Var broadcast = false; // Incase of private messaging.
var array = []; // Incase of public messagingVar array = [clientiid_1]; // Incase of private messaging.
window.EnxRtc.sendMessage( message,true,array);
// Add Event Listeners
window.EnxRtc.addEventListner("onAcknowledgedSendData", function
(data)
{
console.log(JSON.stringify(data.data));
});
window.EnxRtc.addEventListner("onMessageReceived",function (data)
{
console.log(JSON.stringify(data.data));
});
