Skip to content

tarruda/node-msgpack5rpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Node.js Msgpack-RPC(v5 spec) implementation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •