MenuMenu

RTCMultiConnection.changeUserId

Change and update userid across all connected users

Usage

connection.changeUserId('new-userid', function() {
    alert('Your userid is successfully changed to: ' + connection.userid);
});

Description

parameterdescription
callback Optional function; a confirmation from socket.io server

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

btnChangeUserId.onclick = function() {
    connection.changeUserId('new-userid', function() {
        alert('Your userid is successfully changed to: ' + connection.userid);
    });
};

connection.openOrJoin('your-room-id');
</script>