Created
November 28, 2019 07:44
-
-
Save erkanzileli/709ce1e7fcc8fe8dddaeaeee88138f66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const redis = require('redis') | |
const publisher = redis.createClient() | |
const subscriber = redis.createClient() | |
subscriber.psubscribe('channel:*') | |
subscriber.on('psubscribe', console.log) | |
subscriber.on('pmessage', (pattern, channel, message) => console.log(`pattern: ${pattern}, channel: ${channel}, message: ${message}`)) | |
let counter = 0 | |
setInterval(() => { | |
++counter | |
publisher.publish(`channel:${counter}`, `message${counter}`) | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment