Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to know how many clients subscribed a "channel" in redis?

Tags:

node.js

redis

I didnt find any commands to know how many client subscribed a channel (subscribe) in redis... Somebody know?

Thanks,

like image 260
William Avatar asked Apr 03 '11 21:04

William


People also ask

How can I see my Redis subscribers?

You can use PUBSUB NUMSUB channel1 OR PUBSUB NUMSUB channel2 and get reply about the number of subscribers for the specified channel.

How many subscribers can Redis handle?

Regarding the number of subscribers and publishers, it is limited by the maxclients setting, 10,000 by default.

How many channels can Redis handle?

There is no hard limit in Redis on maximum number of channels; it is user configurable.

Which command used to check number of client connected with Redis server?

The CLIENT LIST command returns information and statistics about the client connections server in a mostly human readable format.


1 Answers

Publish

Return value
Integer reply: the number of clients that received the message.

That way when you publish to your channel, you be informed how many users are connected.


You could also keep track of this yourself using incr to increment counter when somebody subscribes to that channel and decr on unsubscribe to that channel. That way you can always know how many users are connected to that channel.

like image 145
Alfred Avatar answered Nov 02 '22 06:11

Alfred