0

I'm testing redis-py: https://github.com/andymccurdy/redis-py.

I have a hard time figuring out how to call and get output for the redis command PUBSUB channels.

Alfred Balle
  • 1,135
  • 4
  • 16
  • 32

1 Answers1

3

To get all channels:

chans = r.pubsub_channels()

To get the number of subscribers to a channel:

num = r.pubsub_numsub('channel')
dizzyf
  • 3,263
  • 19
  • 29
  • This I know. I need the command `PUBSUB channels` so I can get a list of channels and numbers of subscribers. – Alfred Balle Oct 25 '19 at 06:34
  • @AlfredBalle ahh I misunderstood and thought you meant just channel operations in general. Updated my answer – dizzyf Oct 25 '19 at 17:09