Skip to content

Instantly share code, notes, and snippets.

@jk195417
Created March 31, 2018 04:33
Show Gist options
  • Save jk195417/f49b4a7cde6e6af19ff6e430051eeefc to your computer and use it in GitHub Desktop.
Save jk195417/f49b4a7cde6e6af19ff6e430051eeefc to your computer and use it in GitHub Desktop.
redis sub example
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();
@jk195417
Copy link
Author

require node_redis
use npm to install it if not installed before.

$ npm install redis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment