multipub

Clustered redis pub/sub

Showing:

Popularity

Downloads/wk

0

GitHub Stars

64

Maintenance

Last Commit

8yrs ago

Contributors

1

Package

Dependencies

3

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

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:

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);

API

multipub(options)

Options are passed to node_redis's .createClient().

var multipub = require('multipub');
var client = multipub({
  options: 'here'
});

Client#connect(addr)

Add connection to addr, for example "0.0.0.0:4000".

Client#subscribe(pattern)

Subscribe to a channel or pattern, such as "user:login" or "user:*".

Client#unsubscribe(pattern)

Unsubscribe from a channel or pattern, must match exactly what you passed to .subscribe().

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial