NRR (node redis RPC)
Simple rpc for node using redis. This library extends node redis pubsub
and uses its feature as a base. It uses the existing methods on/subscribe
/ emit/publish
to realize a simple rpc
over redis and between node.js instances. Every node.js instance can connect to the event bus, listen to the bus via
pub/sub or register/trigger rpc calls.
Important Changes
- 1.0.8 update
README.md
&.npmignore
file - 1.0.7 updated dependencies
- 1.0.6 removed automatic npm publish from travis
- 1.0.5 updated gruntfile build process, added more comments
- 1.0.4 added redis server to the travis build environment (for tests only)
- 1.0.3 adjusted travis config and unit tests
- 1.0.2 minor changes, added status icons, added travis support
- 1.0.0 first commit
Install
$ npm install node-redis-rpc
Usage
Setup
var NodeRedisRpc = ;var config = host: 'localhost' // redis server hostname port: 6379 // redis server port auth: 'password' // optional password scope: 'test' // use scope to prevent sharing messages between "node redis rpc";var nodeRedisRpcInst = config;
Simple rpc
// Register a listener on the channel "foo:bar" [1]nodeRedisRpcInst; /** * RPC callback handler [3] * * @param {null|*} err error status * @param */var { console; // outputs: 'null' console; // outputs: '{foo: 'bar', num: 123}'}; // Trigger an event on the channel "foo:bar" (received by [1])nodeRedisRpcInst;
More
Please see node redis pubsub for more information on how to use this package's base package e.g. unsubscrbe to a channel.