[![](https://img.shields.io/npm/v/@akiroz/pubsub-rpc)](https://www.npmjs.com/package/@akiroz/pubsub-rpc) ![test](https://github.com/akiroz/pubsub-rpc/workflows/test/badge.svg)

Usage no npm install needed!

<script type="module">
  import akirozPubsubRpc from 'https://cdn.skypack.dev/@akiroz/pubsub-rpc';


PubSub RPC


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

Supports NodeJS and modern browsers.


$ yarn add @akiroz/pubsub-rpc

Why not JSON-RPC?

Native binary support for passing large binary payloads.


  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)}


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