SUNSUBSCRIBE
SUNSUBSCRIBE [shardchannel [shardchannel ...]]
- Group
- Pub/Sub
- Complexity
- O(N) for N shard channels
- Arity
- -1 (at least 1 words, counting the command name)
- Flags
- pubsub
- Keys
- first 1, last final argument, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
SUNSUBSCRIBE removes the given shard channel subscriptions. Without
arguments it removes every shard channel subscription of the connection, and
leaves channel and pattern subscriptions alone.
Return value
Section titled “Return value”One confirmation per shard channel removed (or per shard channel named):
| Element | Value |
|---|---|
| 1 | Bulk string sunsubscribe |
| 2 | Bulk string: the shard channel |
| 3 | Integer: the number of shard channels still subscribed |
When called without arguments and the connection has no shard channel
subscriptions, a single confirmation is sent with a nil channel and a count of
0. On RESP3 the confirmations are push messages.
Examples
Section titled “Examples”127.0.0.1:6379> SSUBSCRIBE orders:{eu}1) "ssubscribe"2) "orders:{eu}"3) (integer) 1127.0.0.1:6379> SUNSUBSCRIBE orders:{eu}1) "sunsubscribe"2) "orders:{eu}"3) (integer) 0Compatibility
Section titled “Compatibility”Same as Redis 7 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.