listUsers()

Returns an array of the current users inside the room.

let users = sambaFrame.listUsers();
console.log('There are', users.length, 'users inside the room:');
console.log(users);

/*Here is how the array looks like:
[
    {
        "id": "08c82f56-c670-4d36-bfe3-87a8cd0f7f29",
        "name": "John",
        "avatarColor": "#90c695",
        "role": "moderator",
        "kind": "local"
    },
    {
        "id": "15a0b10d-5f0f-47a9-9889-1d92651aa6d8",
        "name": "Lucas",
        "avatarColor": "#3498db",
        "role": "moderator",
        "deviceType": "desktop",
        "kind": "remote"
    }
]*/

Sample use case: You want to have a list of the current users participating in the room.

Look at the usersUpdated event if you want to subscribe to an always up-to-date array of the users inside the room.

Last updated