Created
March 31, 2018 04:33
-
-
Save jk195417/f49b4a7cde6e6af19ff6e430051eeefc to your computer and use it in GitHub Desktop.
redis sub example
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
var redis = require("redis"); | |
// open connection | |
var redis_url = "redis://password@host:port" | |
var sub = redis.createClient(redis_url) | |
// subscribe channel test | |
sub.on("message", function (channel, message) { | |
console.log("sub channel " + channel + ": " + message); | |
}); | |
sub.subscribe("test"); | |
// close connection | |
sub.quit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
require node_redis
use npm to install it if not installed before.