SUBSCRIBE
Subscribes the connection to messages on a channel.
Pub/Sub · Example verified
Syntax covered here
SUBSCRIBE channelUse a connection that can process asynchronous messages; the case publishes from a separate connection.
Tested example & replies
Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.
# connection: subscriber
> SUBSCRIBE updates
["subscribe","updates",1]
# connection: default
> PUBSUB NUMSUB updates
["updates",1]
# connection: default
> PUBLISH updates hello
1
# connection: subscriber
# receive pushed message
["message","updates","hello"]
# connection: subscriber
> UNSUBSCRIBE updates
["unsubscribe","updates",0]