How to get the Client Count inside a Socket.IO room? Version 3.1.1

In Version 2.x.x 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.x.x?

I know about the join-room and leave-room events, but i hope for a solution without own counting logic.

17 thoughts on “How to get the Client Count inside a Socket.IO room? Version 3.1.1”

Leave a Comment