Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

PUBSUB

Last updated
PUBSUB CHANNELS [pattern]
PUBSUB NUMSUB [channel [channel ...]]
PUBSUB NUMPAT
PUBSUB SHARDCHANNELS [pattern]
PUBSUB SHARDNUMSUB [shardchannel [shardchannel ...]]
PUBSUB HELP
Group
Pub/Sub
Arity
-2 (at least 2 words, counting the command name)
Flags
pubsub, read-only
HotKV Cloud
All plans
On-Premise
no license needed

PUBSUB is a container for subcommands that report on Pub/Sub activity on the node you ask. They only read state and never deliver messages.

Subcommand What it returns
PUBSUB CHANNELS Channels with at least one subscriber
PUBSUB NUMSUB The subscriber count of each named channel
PUBSUB NUMPAT The number of pattern subscriptions
PUBSUB SHARDCHANNELS Shard channels with at least one subscriber
PUBSUB SHARDNUMSUB The subscriber count of each named shard channel
PUBSUB HELP A short description of each subcommand

An unknown subcommand replies with ERR unknown subcommand '<name>'. Try PUBSUB HELP.

127.0.0.1:6379> PUBSUB CHANNELS
1) "news"
127.0.0.1:6379> PUBSUB NUMSUB news
1) "news"
2) (integer) 2

The same subcommands as Redis 7 and Valkey 8. See PUBSUB NUMPAT for one difference in what it counts.

SUBSCRIBE, PUBLISH, SSUBSCRIBE