PUBSUB CHANNELS

Syntax

  1. PUBSUB CHANNELS [pattern]

Time complexity: O(N) where N is the number of active channels, and assuming constant time pattern matching (relatively short channels and patterns)

Lists the currently active channels, whose name matches pattern.

An active channel is a Pub/Sub channel with one or more subscribers (excluding clients subscribed to patterns).

If no pattern is specified, all the channels are listed, otherwise if pattern is specified only channels matching the specified glob-style pattern are listed.

Return

Array reply: a list of active channels, optionally matching the specified pattern.

Examples

  1. users> PSUBSCRIBE h?llo
  2. users> SUBSCRIBE hello
  3. users> SUBSCRIBE hxxllo
  4. users> SUBSCRIBE world
  5. ---
  6. dragonfly> PUBSUB CHANNELS
  7. 1) "hxxllo"
  8. 2) "world"
  9. 3) "hello"
  10. dragonfly> PUBSUB CHANNELS h*llo
  11. 1) "hxxllo"
  12. 2) "hello"
  13. dragonfly> PUBSUB CHANNELS h?llo
  14. 1) "hello"