adonis-websocket icon indicating copy to clipboard operation
adonis-websocket copied to clipboard

Count subscribe Client

Open websenornarendra opened this issue 6 years ago • 1 comments

It is possible that we can count client in a room

Ex. We have Chat Room with Different Topic And Many Clients subscribe Different Topic

When Client subscribe Any Topic then Count subscribed Client

it is possible

websenornarendra avatar Feb 26 '19 13:02 websenornarendra

At the top of your socket.js or WS Controller var user_count = 0;

when a user joins or disconnects user_count++ or user_count--

and you can emit that variable socket.emit('users', user_count)

edge-rps avatar Mar 18 '19 20:03 edge-rps