PUBSUB CHANNELS
Since 1.1.0Pub/Sub
Syntax
PUBSUB CHANNELS [pattern]Returns the channels that at least one client is subscribed to with SUBSCRIBE, sorted. With pattern, only those whose names match it, with the glob syntax of PSUBSCRIBE: *, ?, [abc]. Use it to see what is being listened to, for example while debugging a publisher whose messages reach no one.
Pattern subscriptions are not channels and are not listed, nor are shard channels; PUBSUB NUMPAT and PUBSUB SHARDCHANNELS cover those. The list is this server's subscribers only: in a cluster, each node answers for the clients connected to it. See Pub/Sub.
Reply
- An array of channel names; an empty array if there are none.
Examples
client 2> SUBSCRIBE news sport
...
client 3> PSUBSCRIBE n*
...
client 1> PUBSUB CHANNELS
1) "news"
2) "sport"
client 1> PUBSUB CHANNELS s*
1) "sport"
client 1> PUBSUB CHANNELS x*
(empty array)