PUBSUB-CHANNELS(3valkey)
β¨ PUBSUB-CHANNELS β¨
okay bestie, gather round π this is a page from the Valkey Command Manual β PUBSUB-CHANNELS(3valkey) β and it's literally about finding out which channels are poppin' off right now. no cap.
π NAME π
pubsub-channels β returns the active channels. that's it, that's the vibe β¨
π¦ SYNOPSIS π¦
PUBSUB CHANNELS [pattern]
π DESCRIPTION π
So like. It lists the currently active channels. π
An active channel is a Pub/Sub channel that has one or more subscribers β and lowkey important: that's excluding clients that are subscribed to patterns. (pattern subscribers, you're valid, but you're not counted here, sorry babe π«Ά)
If you don't give a pattern, then every single channel gets listed. but if you do pass a pattern, then only the channels matching that glob-style pattern show up. cute, right? πΈ
Cluster note, bestie, listen up: in a Valkey Cluster, clients can subscribe to every node, and can also publish to every other node. the cluster will make sure published messages get forwarded wherever they need to go. BUT β and this is the part people always get confused about π β the replies fromvalkey-pubsub(7)PUBSUBin a cluster only report info from that node's Pub/Sub context, not the entire cluster. so you're seeing one node's little world, not the whole kingdom π iykyk.
π REPLY π
valkey-protocol(7) Array reply: a list of active channels, optionally matching the specified pattern. periodt. π
π§ COMPLEXITY π§
O(N) where N is the number of active channels, and assuming constant time pattern matching (relatively short channels and patterns). so like, it scales with how many channels are alive, not how hard the matching is β assuming your patterns aren't doing the most π
π ACL CATEGORIES π
@pubsub@slow
β HISTORY β
- Available since:
2.8.0β an icon, honestly, she's been here forever π
π 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)
and that's the whole page, bestie π«Ά this one's from version 9.0.0, dated 2025-10-21 β go forth and vibe check those channels πβ¨π
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms