订阅
订阅方1:
127.0.0.1:6379> SUBSCRIBE channel1 chanle2
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "channel1"
3) (integer) 1
1) "subscribe"
2) "chanle2"
3) (integer) 2
订阅方2:
127.0.0.1:6379> SUBSCRIBE channel1
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "channel1"
3) (integer) 1
发布消息至管道1:
127.0.0.1:6379> PUBLISH channel1 "this is a msg"
(integer) 2
# 2表示2个订阅方已接受
订阅1 和订阅2收到消息:
1) "message"
2) "channel1"
3) "this is a msg"