userid | RTCMultiConnection

Each user MUST have a unique user identifier.

Using v3, room creator's userid MUST be same as room-id.

Usage

var roomCreatorId = 'room-creator-id';

// first case, room creator
connection.userid = roomCreatorId;
connection.open(connection.userid);

// second case, room joiners
connection.userid = 'set-something-unique';
connection.join(roomCreatorId);

Description

parameterdescription
userid it is a string
v3 has a known issue; whenever someone opens a room, his userid is changed.
behindTheScene.open = function(roomid) {
    // check this line
    // whenever you open room
    // room creator's userid is changed
    // room creator's userid must match roomid
    behindTheScene.userid = roomid;

    // rest of the behind-the-scene code from RTCMultiConnection.js
};

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
};

var roomCreatorId = 'room-creator-id';

btnOpenRoom.onclick = function() {
    // first case, room creator
    connection.userid = roomCreatorId;
    connection.open(connection.userid);
};

btnJoinRoom.onclick = function() {
    // second case, room joiners
    connection.userid = 'set-something-unique';
    connection.join(roomCreatorId);
};
</script>