Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

msgpack5rpc

tarruda34.3k1.1.0

Msgpack-RPC(v5 spec) implementation

msgpack, msgpack5, msgpackv5, v5, rpc, msgpackrpc, msgpack-rpc, msgpack_rpc

readme

msgpack5rpc

Msgpack-RPC(v5 spec) implementation. Based on the

msgpack5 package. See the specification for details.

Build Status

Installation

npm install --save msgpack5rpc

Usage

This package exports a single class which represents a msgpack-rpc session. A Session instance can attached to any pair of write/read streams, and can send and receive requests and notifications, so it can be used for both client and servers. Example:

var Session = require('msgpack5rpc');

var session = new Session();
session.attach(process.stdout, process.stdin);
session.on('request', function(method, args, resp) {
  resp.send('response!');
  console.log('received request');
  session.request('remote-method', ['arg1', 'arg2'], function(err, res) {
    console.log('received response');
  });
});
session.on('notification', function(method, args) {
  console.log('received notification');
  session.notify('remote-event', ['arg1', 'arg2']);
});

See the "examples" subdirectory for a complete client/server implementation.