Created
January 19, 2020 15:59
-
-
Save tsh-code/a378381d32f4c386673f3cf4792c15f2 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 subscriber = redis.createClient({ | |
url: "redis://localhost:6379" | |
}); | |
const publisher = subscriber.duplicate(); | |
const WS_CHANNEL = "ws:messages"; | |
subscriber.on("message", (channel, message) => { | |
console.log(`Message from: ${channel}, ${message}`); | |
}); | |
subscriber.subscribe(WS_CHANNEL); | |
publisher.publish(WS_CHANNEL, "my message"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment