RTCMultiConnection Log
www.RTCMultiConnection.org

RTCMultiConnection FAQ | Documentation | Demos!

RTCMultiConnection is part of WebRTC Experiments that's why MIT Licenced. It means that you can use it in any project; however the only limitation is you MUST NOT remove "licence" headers from the top of each javascript file!

Browsers Support?

  1. Chrome (all versions) - Desktop/Android - Windows/Linux/Mac
  2. Firefox (all versions) - Desktop/Android - Windows/Linux/Mac
  3. Opera (all versions) - Desktop/Android - Windows/Linux/Mac
  4. All chromium based embedded systems e.g. Node-webkit, cross-walk project etc.
  5. IE/Safari (Temasys plugin) [a v1.8 based demo coming soon]

Signaling?

RTCMultiConnection never cares about signaling gateways; it is up to you to decide whether you are willing to use MySQL, MS-SQL or WebSockets, WebSync, SignalR, or SignalMaster or PeerServer or SIP, XMPP, or any thing else exists in the globe! Read more here!

What is a channel?

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.

You may hear about a similar concept known as "namespaces" used in socket.io for rooms partitioning.

Namespaces are usually known as "socket.io rooms".

What is a "session-id"?

  1. As you can see in the diagram, "session-id" is a reference to the "actual session" that exists on socket.io server.
  2. Sessions are accessed and used using unique identifiers known as "session-id".
  3. Two or more users must have identical "session-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.
  4. 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. "session-id" is a clue of the signaling service to connect the relevant session to exchange data privately and reliably among users.
  5. var userA = new RTCMultiConnection('channel-id-007');
    var userB = new RTCMultiConnection('channel-id-007');
    var userC = new RTCMultiConnection('channel-id-007');
    
  6. As you can see; userA, userB and userC used same session-id i.e. "sessionid-007".
  7. // Parameters are optional
    userA.connect('sessionid-007');
    userB.connect('sessionid-007');
    userC.connect('sessionid-007');
    
  8. "connect" method allows you get a reference to the "actual signaling session" that exists on signaling server.
  9. It means that userA says, "I'm also part of this session. All messages transmitted over this session must be passed to me as well."
  10. Now, userA can send participation requests to session-initiator. He can update statuses like mute/unmute, or start/stop or available/busy etc.
  11. UserA can connect existing session participations if allowed by the session-initiator.

Who is "session-initiator"?

A person who setups/starts/opens the session is known as "session-initiator".
  1. var initiator = new RTCMultiConnection();
    initiator.open('new-session-007');
    
  2. "open" method allows you allocate initiator and setup new session on the signaling server.
  3. Other users will use "connect" method to join same session.
  4. var participant = new RTCMultiConnection();
    participant.connect('new-session-007');
    
  5. In RTCMultiConnection sessions; "initiator" plays role of a bridge for conferencing participants.
  6. RTCMultiConnection supports feature like "keepAlive" which means that "keep session active even if initiator leaves".

Some identical questions:

  1. Should all users be part of a namespace/channel/session?
  2. Session unique identifier should be same for all users?
  3. Should each user have a unique session-id for his session?

Answer:

  1. A channel is always mandatory whether you call users by using their user-ids; or ask them join an existing rooms using room-ids.
  2. As explained earlier; a channel is actually a reference to the signaling server. Signaling server MUST be identical between two users to detect and exchange data.
  3. A channel can be a PHP file URL to POST/GET data.
  4. A "session-id" allows us setup multiple unique channels on the server which is helpful to open multiple concurrent rooms.
  5. Again, a "session-id" will always be a reference to the unique channel/session on the signaling server.

Differentiate "open" and "connect" methods:

  1. var initiator = new RTCMultiConnection();
    initiator.open('new-session-007');
    		
    var participant1 = new RTCMultiConnection();
    participant1.connect('new-session-007');
    
    var participant2 = new RTCMultiConnection();
    participant2.connect('new-session-007');
    
    var participant3 = new RTCMultiConnection();
    participant3.connect('new-session-007');
    
    var participant4 = new RTCMultiConnection();
    participant4.connect('new-session-007');
    
  2. As you can see; there is only one initiator; however there are 4 session participant/connectors.
  3. "open" method is used merely once for the session-initiator to setup a new channel/session on the signaling server.
  4. "connect" method is called by multiple users to join an existing session on the signaling server.
  5. "connect" doesn't means that you're part of a conference.
  6. You can join a conferencing room using "join" method; which is automatically called if you've not overridden "onNewSession" event.

Differentiate "connect" and "join" methods:

  1. var participant = new RTCMultiConnection();
    
    participant.onNewSession = function(session) {
        // found a conferencing room; join it!
        participant.join(session);
    };
    
    // connecting to the signaling channel
    participant.connect('new-session-007');
    
  2. When you call "connect" method; you're actually setting up signaling channel. You're not part of conferencing room yet.
  3. "join" method can be used only when you already connected with a signaling channel. "join" method allows you join conferencing room.

How do I get a session to join?

  1. You can override "onNewSession" event to be alerted for each new session.
  2. participant.onNewSession = function(session) {
        // found a conferencing room; joining it!
        participant.join(session);
    };
    

Why are there two "connect" statements with different session-ids?

  1. io.connect(SIGNALING_SERVER).emit('new-channel', {
        channel: channel,
        sender: sender
    });
    
    var socket = io.connect(SIGNALING_SERVER + channel);
    
  2. This thing is better explained in another document: "WebRTC Signaling Concepts".
  3. Dynamic namespaces in socket.io is always been a tough task. It is not possible to connect to a random/dynamic namespace directly in the browser.
  4. "new-channel" event is listened on the nodejs server to setup dynamic socket.io namespace.
  5. // it is socketio-over-nodejs
    socket.on('new-channel', function (data) {
        channels[data.channel] = data.channel;
        onNewNamespace(data.channel, data.sender);
    });
    
  6. It is suggested to setup a global socket object that can be used to open dynamic namespace.
  7. // it is browser-side code
    var globalSocketObject = io.connect(SIGNALING_SERVER);
    
    connection.openSignalingChannel = function(config) {
        globalSocketObject.emit('new-channel', {
            channel: channel,
            sender: sender
        });
    
        var socketWithDynamicNamespace = io.connect(SIGNALING_SERVER + channel);
    };
    

Useful Links:

  1. https://www.webrtc-experiment.com/docs/WebRTC-Signaling-Concepts.html
  2. https://github.com/LearnBoost/socket.io/wiki/Rooms


Want to ask a Question?

You can include your Email as well; which will be kept private!

Latest Updates