RTCMultiConnection Docs

RTCMultiConnection.join | "method"

HOME © Muaz Khan . @WebRTCWeb . Github . Latest issues . What's New?

"connection.join" method allows you join a WebRTC room.

RTCMultiConnection v3:

"connection.join" method accepts "room-id" as first argument; and [optional] password as second argument:

connection.join( 'room-id' );

// or
var password = 'xyz';
connection.join( 'room-id', password );

RTCMultiConnection v2:

  1. join method is used/called only for participant. It should NEVER be called for initiator!
    if(you_are_participant) {
        connection.join('sessionid');
    }
    
  2. Since v1.7, you can pass "sessionid" directly over "join" method:
    // make sure that room is created!
    // otherwise this "join" method will fail to join the room!
    // "join" method NEVER waits for onNewSession!!
    // it directly "joins" the room!
    if(you_are_participant) {
        connection.join('sessionid');
    }
    
    // otherwise, you can pass "room-description"
    // or "session-description" object over "join" method!
    var sessionDescription = {
        sessionid: 'abcdef',
        userid: 'xyz',
        extra: {},
        session: {
            audio: true,
            video: true
        }
    };
    
    if(you_are_participant) {
        connection.join( sessionDescription );
    }
    
  3. Since v1.7, "open" method returns "sessionDescription" or "roomDescription" object:
  4. For initiator:

    var initiator = new RTCMultiConnection();
    
    // you can pass object instead of string!
    var sessionDescription = initiator.open({
        dontTransmit: true
    });
    
    // initiator will NEVER call "join" method!
    
    websocket.send(sessionDescription);
    
  5. For participant:

    var participant = new RTCMultiConnection();
    
    websocket.onmessage = function(event) {
        var sessionDescription = event.data.sessionDescription;
        
        if(you_are_participant) {
            participant.join( sessionDescription );
        }
    };
    
  6. v1.6 and earlier versions allows you get "sessionDescription" or "roomDescription" from "onNewSession" event:
    // or
    connection.onNewSession = function(session) {
        session.join();                           // join session as it is!
        session.join({audio: true});              // join session while allowing only audio
        session.join({video: true});              // join session while allowing only video
        session.join({screen: true});             // join session while allowing only screen
        session.join({audio: true, video: true}); // join session while allowing both audio and video
        
        session.join({oneway: true}); // to join with no stream!
        
        // you can even use "connection.join" method
        connection.join( session );
    };
    

Latest Issues

Want to ask a Question?

You can include your email for private conversation!

Latest Updates