In Redis Pub/Sub, we create different Redis channels as per the application requirement. Each application using Redis Pub/Sub will use these channels for either publishing purposes or subscribing purposes.
Whenever any application publishes a message to a channel, all subscriber client applications which have subscribed to that channel will be notified immediately of that message.
Below we know about two important commands used in Redis PUB/SUB implementation.
The below command will list all active channels for the connected Redis instance.
PUBSUB CHANNELS
If you want to know the number of subscribers to a channel, then you can use the below command. This will return the number of subscribers to a particular channel.
PUBSUB NUMSUB channelName