SSUBSCRIBE

SSUBSCRIBE shardchannel [shardchannel ...]
Available since:
Redis Open Source 7.0.0
Time complexity:
O(N) where N is the number of shard channels to subscribe to.
ACL categories:
@pubsub, @slow,
Compatibility:
Redis Software and Redis Cloud compatibility

Subscribes the client to the specified shard channels.

In Redis Cluster, shard channels are assigned to slots with the same algorithm Redis uses to assign keys to slots. To receive messages published to a shard channel, subscribe to a node, either a primary or replica, that serves the channel’s slot.

All shard channels in a single SSUBSCRIBE call must belong to the same slot. To subscribe to shard channels across different slots, use separate SSUBSCRIBE calls.

For more information about sharded Pub/Sub, see Sharded Pub/Sub.

Required arguments

shardchannel [shardchannel ...]

One or more shard channels to subscribe to.

Examples

> ssubscribe orders
Reading messages... (press Ctrl-C to quit)
1) "ssubscribe"
2) "orders"
3) (integer) 1
1) "smessage"
2) "orders"
3) "hello"

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
✅ Standard
✅ Active-Active
✅ Standard
✅ Active-Active

Return information

When successful, this command doesn't return anything. Instead, for each shard channel, one message with the first element being the string ssubscribe is pushed as a confirmation that the command succeeded. Note that this command can also return a -MOVED redirect.
RATE THIS PAGE
Back to top ↑