PubSub RPC
A generic RPC mechanism for Pub/Sub transports based on MsgPack
Supports NodeJS and modern browsers.
Why not JSON-RPC?
Native binary support for passing large binary payloads.
Mechanism
- Callee subscribe to
topic
- Caller subscribe to
topic/${base64(id)}
- Caller publish to
topic
with a binary id
(default 16 byte) in the payload - Callee calls RPC handler with
params
in the payload to get result
or error
response - Callee publish response to
topic/${base64(id)}
- Caller unsubscribe from
topic/${base64(id)}
API
await register(pubSubClient, topic, async (params, topic) => {
return result;
});
const result = await call(pubSubClient, topic, params);