RTCMultiConnection Docs

RTCMultiConnection API Reference / "sendCustomMessage" method

  1. Using sendCustomMessage method; you can share public messages over the default socket. E.g.
    1. State of the session-participant or session-initiator; whether he is going to leave; or going to share a media stream.
    2. Ask a session-participant to broadcast screen or video in one-way direction.
    3. Ask session-participants to attach audio stream; even if it is oneway stream coming from session-initiator.
    4. There are unlimited scenarios; that can be accomplished using sendCustomMessage method; just imagine and go ahead and use it!
  2. connection.sendCustomMessage(any_kind_of_data |or| string_message);
    
  3. Custom messages can be received using onCustomMessage event.
  4. connection.onCustomMessage = function(message) { };
    
  5. For private "custom" messages; try "peers" object:
  6. // send private message to target user; privacy is guaranteed!
    connection.peers['user-id'].sendCustomMessage('private-message');
    connection.peers['user-id'].onCustomMessage = function(privateMessage) {
        console.log('private custom message', privateMessage);
    };
    

Want to ask a Question?

You can include your email for private conversation!