Hi!
I would like to ask for some help on retrieving the number of users in the room. I'm using the WebRTC tutorial here
There is a part where we call startWebRTC function based on the number of members in the room.
room.on('members', members => {
if (members.length >= 3) {
return alert('The room is full');
}
// If we are the second user to connect to the room we will be creating the offer
const isOfferer = members.length === 2;
startWebRTC(isOfferer);
startListentingToSignals();
});
I might have missunderstood the documentation, I thought this listener will retrieve every member in the room.
When I log out the room and the members variable provided by the listener I get these:
room:
Room {
name: "observable-REMOVED"
scaledrone: Scaledrone {args: Arguments(1), originalInstance: Scaledrone, readyState: 2, callbackId: 2, callbacks: {…}, …}
_cache: [{…}]
_events: {
data: [{…}]
member_join: [{…}]
members: Array(5)
0: {callback: ƒ, context: undefined, ctx: Room}
1: {callback: ƒ, context: undefined, ctx: Room}
2: {callback: ƒ, context: undefined, ctx: Room}
3: {callback: ƒ, context: undefined, ctx: Room}
4: {callback: ƒ, context: undefined, ctx: Room}
...
As you can see here, there is 5 ppl in the room already, while the event listener will log this:
members array in the listener
MEMBERS:
0: {id: "BlrBA6qWpK"}
length: 1
__proto__: Array(0)
Can you please help me out with this one? Is there any other way to retrieve the number of users in the room?
Also forgot to mention that I can see the connected members if I visit my scaledrone dashboard.
Thanks!
Hi!
I would like to ask for some help on retrieving the number of users in the room. I'm using the WebRTC tutorial here
There is a part where we call
startWebRTCfunction based on the number of members in the room.I might have missunderstood the documentation, I thought this listener will retrieve every member in the room.
When I log out the room and the members variable provided by the listener I get these:
room:As you can see here, there is 5 ppl in the room already, while the event listener will log this:
members array in the listenerCan you please help me out with this one? Is there any other way to retrieve the number of users in the room?
Also forgot to mention that I can see the connected members if I visit my scaledrone dashboard.
Thanks!