@ros2jsguy/msgpack-rpc-node
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

msgpack-rpc-node

MessagePack RPC implementation for Node This package is a temporary fork of theJian's package which fixes decode() failures when a TCP msg is fragmented across multiple packets. It also upgrades to the latest @msgpack/msgpack version (2.7.2) and typescript v4.

Installation

$ npm install msgpack-rpc-node
$ yarn add msgpack-rpc-node

Overview

import { Server, TcpServer, Client, TcpClient } from 'msgpack-rpc-node';

const PORT = 3000;

// Create a server
const server = new Server({
  add(a, b) {
    return a + b;
  }
});

// Listen on port 3000
server.listen(TcpServer, PORT);


// Create a client that connects to port 3000 on localhost
const client = new Client(TcpClient, PORT);
await client.connect();

// Calling function add and passing 3 and 5 as arguments
const result = await client.call('add', 3, 5);

License

MIT@theJian

Readme

Keywords

Package Sidebar

Install

npm i @ros2jsguy/msgpack-rpc-node

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

77.3 kB

Total Files

43

Last publish

Collaborators

  • ros2jsguy