Socket
Book a DemoInstallSign in
Socket

fast-msgpack-rpc

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-msgpack-rpc

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

latest
Source
npmnpm
Version
0.0.12
Version published
Maintainers
1
Created
Source

maxtaco/node-fast-msgpack-rpc

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);
      }
   }
});
srv.listen(8000);

a corresponding client might look like:

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

Or, equivalently, in beautiful IcedCoffeeScript:

await (c = rpc.createClient '127.0.0.1', 8000, defer(ok), "myprog.v1")
await c.invoke 'add', { a : 5, b : 4 }, defer err, response
c.close()

Advanced Usage

(documentation to come)

Installation

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)

FAQs

Package last updated on 16 Nov 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts