getAllParticipants | RTCMultiConnection

Get array of all users ids.

See who is connected with you.

Usage

connection.getAllParticipants().forEach(function(participantId) {
    var user = connection.peers[participantId];
    var hisFullName = user.extra.fullName;
    var hisUID = user.userid;
    var hisNativePeer = user.peer;
    var hisIncomingStreams = user.peer.getRemoteStreams();
    var hisDataChannels = user.channels;
});

Description

parameterdescription
getAllParticipants this method returns array (list) of user-ids (users that are connected with you)
var numberOfUsers = connection.getAllParticipants().length;

var arrayOfUserIds = connection.getAllParticipants();
// you will get something like this
arrayOfUserIds === ['first', 'second', 'third', 'fourth', 'so-on'];

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

btnGetUserInfo.onclick = function() {
    connection.getAllParticipants().forEach(function(participantId) {
        var user = connection.peers[participantId];
        var hisUID = user.userid;
        alert(hisUID + ' connected with you.');
    });

    var numberOfUsers = connection.getAllParticipants().length;
    alert(numberOfUsers + ' users connected with you.');
};

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