Socket
Book a DemoInstallSign in
Socket

multipub

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multipub

multi-redis pub/sub

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

multipub

Multi-redis pub/sub allowing you to publish and subscribe to and from N redis nodes.

Installation

$ npm install multipub

Example

Launch some redis nodes:

$ redis-server --port 4000 &
$ redis-server --port 4001 &
$ redis-server --port 4002 &

PUB/SUB, all options passsed to multipub({ ... }) are passed to the underlying redis.createClient() calls.

var multipub = require('multipub');

var client = multipub();

client.connect('localhost:4000');
client.connect('localhost:4001');
client.connect('localhost:4002');

client.subscribe('user:*');

client.on('message', function(channel, msg){
  console.log('%s - %s', channel, msg);
});

setInterval(function(){
  client.publish('user:login', { name: 'tobi' });
}, 50);

setInterval(function(){
  client.publish('user:login', { name: 'loki' });
}, 500);

License

MIT

Keywords

redis

FAQs

Package last updated on 06 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts