Package Exports
- msgpack5rpc
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (msgpack5rpc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
msgpack5rpc
Msgpack-RPC(v5 spec) implementation. Based on the
msgpack5 package. See the specification for details.
Installation
npm install --save msgpack5rpcUsage
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.
