open | RTCMultiConnection

Open rooms.

Usage

connection.open('room-id');

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.open('room-id', function() {
    // open callback
});

Open public room

// look at second parameter
// it is a boolean
// "true" means make it a public-room
connection.open('room-id', true);

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

connection.open({
    sessionid: 'room-id',
    transmitRoomOnce: true
});

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>