A generic RPC mechanism for Pub/Sub transports based on MsgPack
Supports NodeJS and modern browsers.
$ yarn add @akiroz/pubsub-rpc
Native binary support for passing large binary payloads.
- Callee subscribe to
topic
- Caller subscribe to
topic/${base64(id)}
- Caller publish to
topic
with a binaryid
(default 16 byte) in the payload - Callee calls RPC handler with
params
in the payload to getresult
orerror
response - Callee publish response to
topic/${base64(id)}
- Caller unsubscribe from
topic/${base64(id)}
See tests for a basic use case that simply uses an EventEmitter as the Pub/Sub mechanism.