Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Messaging framework using Redis
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
README.md
nodredismsg.js
package.json
testcli1.js
testcli2.js
testsrv.js

README.md

nodredismsg

Messaging framework using Redis

Examples

Server side

var nodredismsg = require('nodredismsg');

var c = new nodredismsg.connect();

var s1 = c.listen_for_operations('multiply', 4);
s1.on('error', console.error);
s1.on('operation', function (oper, res) {
    console.log(res.id);
    res.answer(oper[0]*oper[1]);
});

var s2 = c.listen_for_operations({op:'log', qtt:1, timeout:5, retries:5});
s2.on('error', console.error);
s2.on('operation', function (oper, res) {
    console.log(oper);
    res.aborted();
});

Client side

var nodredismsg = require('nodredismsg');

var c = new nodredismsg.connect();
c.request_operation("multiply", [15, 19], function (err, id) {
    if(err) {
        console.log(err);
        return;
    }
    c.operation_result(id, 10, function (err, ans) {
        console.log([err, ans]);
    });
});
Something went wrong with that request. Please try again.