50

I search through redis command list. I couldn't find the command to get all the available channels in redis pub/sub. In meteor server, the equivalent command is LISTCHANNELS, where it lists all known channels, the number of messages stored on each one and the number of current subscribers.

I have a cron that needs to periodically know about the available channels. Does redis have native command for this? Or I need to find a way to implement it myself?

hexacyanide
  • 88,222
  • 31
  • 159
  • 162
Shuwn Yuan Tee
  • 5,578
  • 6
  • 28
  • 42

3 Answers3

95

PUBSUB CHANNELS does this as of version 2.8.0.

hexacyanide
  • 88,222
  • 31
  • 159
  • 162
nahelm
  • 1,026
  • 8
  • 7
13

There is no existing command - look at http://redis.io/commands#pubsub. You can save all channels' names in SET and retrieve them, when it is required.

hexacyanide
  • 88,222
  • 31
  • 159
  • 162
Ilia Kondrashov
  • 715
  • 2
  • 9
  • 14
9

List all redis channels (2 ways):

PUBSUB CHANNELS
PUBSUB CHANNELS *

Or use wild card names:

PUBSUB CHANNELS mystarter*

They will check the pattern which matchs the strings more reference go to: http://redis.io/commands/pubsub

Xin
  • 33,823
  • 14
  • 84
  • 85