@akiroz/pubsub-rpc
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

PubSub RPC

test

A generic RPC mechanism for Pub/Sub transports based on MsgPack

Supports NodeJS and modern browsers.

Installing

$ yarn add @akiroz/pubsub-rpc

Why not JSON-RPC?

Native binary support for passing large binary payloads.

Mechanism

  1. Callee subscribe to topic
  2. Caller subscribe to topic/${base64(id)}
  3. Caller publish to topic with a binary id (default 16 byte) in the payload
  4. Callee calls RPC handler with params in the payload to get result or error response
  5. Callee publish response to topic/${base64(id)}
  6. Caller unsubscribe from topic/${base64(id)}

API

See tests for a basic use case that simply uses an EventEmitter as the Pub/Sub mechanism.

Readme

Keywords

none

Package Sidebar

Install

npm i @akiroz/pubsub-rpc

Weekly Downloads

13

Version

0.1.1

License

none

Unpacked Size

22.7 kB

Total Files

20

Last publish

Collaborators

  • akiroz