The EnxRoom.sendMessage() 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.

Class: EnxRoom

Method: -(void)sendMessage:(NSString *)message isBroadCast:(BOOL)broadcast recipientIDs:(NSArray *)clientIds;

Parameters:

  • message – String type message.
  • 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.

Delegate Method:

  • - room:didMessageReceived: – Receives message in JSONObject.
NSArray *clientArray = [NSArray arrayWithObjects:@"xxx",@"xxx", nil]

// Private message to one or selected Recipients
[room sendMessage:[NSString stringWithFormat:@"%@",text] isBroadCast:true recipientIDs:clientArray]; 

// Users Receive Message through Callback 
// Available from v1.5.3.
- (void)room:(EnxRoom *)room didMessageReceived:(NSArray *)data {
    // data contains incoming message
}