MenuMenu

RTCMultiConnection.join

Join any RTCMultiConnection room

Usage

connection.join('room-id');

// this one is recommended
connection.join('room-id', function(isJoined, roomid, error) {
    if(isJoined === false) {
        alert(error); // maybe room doesn't exist or room is full or password is invalid
    }
    else {
        alert('Successfully joined the room.');
    }
});

Best practice

connection.checkPresence('room-id', function(isRoomExist, roomid) {
    if (isRoomExist === true) {
        connection.join(roomid);
    } else {
        connection.open(roomid);
    }
});

Description

parameterdescription
roomid it is a string
callback it is an optional function callback
connection.join('room-id', function(isRoomJoined, roomid, error) {
    if(isRoomJoined === false) {
        alert(error); // maybe room doesn't exist or room is full or password is invalid
    }
    else {
        alert('Successfully joined the room.');
    }
});

v2 (old codes) [does not applies to v3 or newer releases]

var sessionDescription = {
    sessionid: 'room-id',
    userid: 'room-creator-id',
    extra: {},
    session: {
        audio: true,
        video: true
    }
};

connection.join(sessionDescription);

Demo

<script src="https://rtcmulticonnection.herokuapp.com/dist/RTCMultiConnection.min.js"></script>
<script src="https://rtcmulticonnection.herokuapp.com/socket.io/socket.io.js"></script>

<script>
var connection = new RTCMultiConnection();

// this line is VERY_important
connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/';

// if you want audio+video conferencing
connection.session = {
    audio: true,
    video: true
};

btnJoinRoom.onclick = function() {
    connection.join('room-id');
};

btnOpenRoom.onclick = function() {
    connection.open('room-id');
};
</script>