准备工作:连接两个redis
cd /usr/local/bin
redis-server hconfig/redis.conf
redise-cli -p 6379
客户端订阅名为 channal1的频道
SUBSCRIBE channal1
Reading messages... (press Ctrl-C to quit)
- "subscribe"
- "channal1"
- (integer) 1
服务端向channel1发送 hello
publish channal1 hello
客户端订阅名为 channal1的频道 接收到 hello
127.0.0.1:6379> SUBSCRIBE channal1
Reading messages... (press Ctrl-C to quit)
- "subscribe"
- "channal1"
- (integer) 1
- "message"
- "channal1"
- "hello"