William
William

Reputation: 199

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

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

Thanks,

Upvotes: 6

Views: 602

Answers (1)

Alfred
Alfred

Reputation: 61771

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.

Upvotes: 6

Related Questions