In Version 2.xx it was possible to write
socket.in('room_id').clients((err, clients) => clients.length);
Is there a similar way to this in Version 3.1.1 / 3.xx?
I know about the join-room and leave-room events, but i hope for a solution without own counting logic.
After some research i found out they simply renamed it into "allSockets" and changed it a little bit. The new solution now looks like this:
let length = await socket.in('room_id').allSockets().length;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.