gitbhub
github
目录
文件内容
redis-push.js
var redis = require('redis');
var client = redis.createClient(6379,'localhost');
client.publish('testPublish','message from publish.js')
redis-sub1.js
var redis = require('redis');
var client = redis.createClient(6379,'localhost');
client.subscribe('testPublish')
client.on('message',(channel,msg) => {
console.log(channel)
console.log(msg)
})
redis-sub2.js
var redis = require('redis');
var client = redis.createClient(6379,'localhost');
client.subscribe('testPublish')
client.on('message',(channel,msg) => {
console.log(channel)
console.log(msg)
})
先订阅
再发布,订阅者就能看到发布者发布过来的信息
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。