pubsub-channels.3valkey - Man Page

Returns the active channels.

Synopsis

PUBSUB CHANNELS [pattern]

Description

Lists the currently active channels.

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.

Cluster note: in a Valkey Cluster clients can subscribe to every node, and can also publish to every other node. The cluster will make sure that published messages are forwarded as needed. That said, PUBSUB’s replies in a cluster only report information from the node’s Pub/Sub context, rather than the entire cluster.

Reply

valkey-protocol(7) Array reply: a list of active channels, optionally matching the specified pattern.

Complexity

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

Acl Categories

@pubsub @slow

History

See Also

psubscribe(3valkey), publish(3valkey), pubsub(3valkey), pubsub-help(3valkey), pubsub-numpat(3valkey), pubsub-numsub(3valkey), pubsub-shardchannels(3valkey), pubsub-shardnumsub(3valkey), punsubscribe(3valkey), spublish(3valkey), ssubscribe(3valkey), subscribe(3valkey), sunsubscribe(3valkey), unsubscribe(3valkey)

Info

2024-09-23 8.0.0 Valkey Command Manual