node package manager


A non-compatible variant of the Msgpack-RPC protocol specification for node.js


node-fast-msgpack-rpc is an implementation of the Msgpack-RPC protocol specification for node.js. Msgpack-RPC is built ontop of the very fast MessagePack serialization format. This implementation supports tcp and unix socket transports.

This is a "fast" version of Msgpack-RPC. The big difference here is that the length of the packet is prepended to each packet, meaning we don't need to keep iteratively decoding the packet over and over again. Seems weird they left this out. This protocol is not compatible with the existing Msgpack, but this module has the same API.

Simple Usage

If you don't care too much about keeping custom per-connection state, it's easy to make a simple RPC server:

var rpc = require('fast-msgpack-rpc');
var srv = rpc.createServer({
   "myprog.v1" : {
      add : function(arg, response) {
         response.result(arg.a + arg.b);

a corresponding client might look like:

var c = rpc.createClient('', 8000, 
    function() {
        c.invoke('add', { a : 5, b : 4}, 
            function(err, response) {
                assert.equal(9, response);
    }, "myprog.v1");

Or, equivalently, in beautiful IcedCoffeeScript:

await (= rpc.createClient ''8000defer(ok)"myprog.v1")
await c.invoke 'add'{ : 5: 4 }defer errresponse

Advanced Usage

(documentation to come)


First you will need to install the msgpack2 add-on

To install node-msgpack-rpc with npm:

npm install -g msgpack2

Debug and Tracing Hooks

(documentation to come)