RTCMultiConnection Docs

RTCMultiConnection API Reference / "channel-id"

Basically channel-id doesn't matters. It is used as optional-feature to make sure relevant-messages are shared with relevant users; and other users will NEVER EVER be able to see/access those messages even using hacking techniques or development tools!
  1. A "channel-id" can be set like this:
    1. var connection = new RTCMultiConnection('channel-id');
      
      // or
      var connection = new RTCMultiConnection();
      connection.channel = 'channel-id';
      
  2. A channel is a signaling room contains two or more connected clients; data travels privately inside the room; which gives us flexibility in transmission and simplicity in management.
  3. You may hear about a similar concept known as "namespaces" used in socket.io for rooms partitioning.
  4. Namespaces are usually known as "socket.io rooms".
  5. As you can see in the diagram, "channel/session-id" is a reference to the "actual channel" that exists on socket.io server.
  6. Sessions are accessed and used using unique identifiers known as "session-id" or "channel-id".
  7. Two or more users must have identical "channel-id" otherwise it will not possible to get clue of those users. Remember, peer detection is one of the most important factor in WebRTC; otherwise, all subsequent processes will fail.
  8. We need to detect peers; send participation requests; exchange data like SDP/ICE; and update states; all such things need a gateway or a signaling service to exchange data between two or more users. "channel-id" is a clue of the signaling service to connect the relevant session to exchange data privately and reliably among users.
  9. var userA = new RTCMultiConnection('channel-id-007');
    var userB = new RTCMultiConnection('channel-id-007');
    var userC = new RTCMultiConnection('channel-id-007');
    
  10. As you can see; userA, userB and userC used same channel-id i.e. "channel-id-007".
  11. For more information; read RTCMultiConnection FAQ.

FAQ

  1. Does channelid have a specific characters or format? Must be a number or for example an hash like md5? So I basically pass the channelid to the RTCMultiConnection() API and to the other connect/open/join.

    It depends upon your server and how you're passing channel-id.

    var channelid = 'ABCdef123!@#$%^&*()_+]]{}|`~?.>,<';
    var connection = new RTCMultiConnection( channelid);
    

    If you're passing channel-id using URL like this:

    http://your-domain.com/channels/channel-id
    

    Then You MUST care about non-allowed or reserved characters like back-slash (/), dots (.), question marks (?), exclamation marks (?), etc.

    If you're passing using URL parameter; then you can pass whatever you want:

    http://your-domain.com/channels/?channelid=Muaz+Name!+Good/+Wow+Awesome
    

    You may need to care about "?" if you're using URL parameters.

    If you're passing channel-id using XHR/FormData then there is no limitation!

    var formData = new FormData();
    formData.append('channel-id', 'ABC?DE!/G*$%2140654(FD}[\543[]~fre');
    $.post('/StoreChannelid.php', formData, success_callback);
    

    Basically channel-id doesn't matters. It is used as optional-feature to make sure relevant-messages are shared with relevant users; and other users will NEVER EVER be able to see/access those messages even using hacking techniques or development tools!

    So, we will have a reliable signaling among users with less chances of failures or attacks!



Want to ask a Question?

You can include your email for private conversation!