PUBSUB

Reports the number of channel subscribers.

Pub/Sub · Example verified

Syntax covered here

PUBSUB NUMSUB channel

NUMSUB was checked while a separate connection held an active SUBSCRIBE subscription.

Tested example & replies

Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.

# connection: subscriber
> SUBSCRIBE updates
["subscribe","updates",1]
# connection: default
> PUBSUB NUMSUB updates
["updates",1]
# connection: default
> PUBLISH updates hello
1
# connection: subscriber
# receive pushed message
["message","updates","hello"]
# connection: subscriber
> UNSUBSCRIBE updates
["unsubscribe","updates",0]