Open a room if does not exist, otherwise join it
connection.openOrJoin('room-id');
parameter | description |
---|---|
roomid | it is a string |
callback |
it has an optional function callback
connection.openOrJoin('room-id', function(isRoomCreated, roomid, error) { if (connection.isInitiator === true) { // you opened the room } else { // you joined it } }); |
<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 }; connection.openOrJoin('your-room-id'); </script>