Description
Redis is awesome. But have you seen how one accomplishes pub/sub with the (otherwise incredibly awesome) redis module? Good ol' fashion event emitting/listening but using redis instead of node's native event emitter.
Get Deps
Redis needs to be running somewhere. Tests need mocha installed.
Install
npm install remitter --save
Usage
const Remitter = require('remitter');
const thing = Remitter(process.env.REDIS_URL);
thing
.connect()
.then(() => {
thing.on('foo', (foo) => {
console.log('foo');
});
});
const thing2 = Remitter(process.env.REDIS_URL);
thing2
.connect()
.then(() => {
thing2.emit('foo', { beep: 'boop' });
});
}
Test
npm test