使用办法: 订阅端: Subscribe 频道名称 发布端: publish 频道名称 发布内容
客户端例子: redis 127.0.0.1:6379> subscribe news Reading messages... (press Ctrl-C to quit)
- "subscribe"
- "news"
- (integer) 1
- "message"
- "news"
- "good good study"
- "message"
- "news"
- "day day up"
服务端例子: redis 127.0.0.1:6379> publish news 'good good study' (integer) 1 redis 127.0.0.1:6379> publish news 'day day up' (integer) 1
监听news: 批量监听new开头的频道: 发消息给news: (返回的是收到广播的用户/终端数)