redis-agent
v0.1.3
Published
A high level API for interacting with redis
Downloads
9
Readme
@davidahouse/redis-agent
Install
$ npm install --save redis-agent
Usage
const RedisAgent = require('redis-agent')
const conf = {redisHost: '', redisPort: 9999, reidsPassword: null, agentName: '', heartbeatPrefix: '', heartbeatInterval: null}
const agent = new RedisAgent(conf)
Subscribe to receive pub/sub messages
agent.subscribe(['events*'])
Receiving messages
agent.on('message', function(msg) {
// Called for every message received
})
agent.on('event_123', function(msg) {
// Or you can have a handler for each message
// type
})
Sending messages
agent.send('event_123', msg)