Socket
Socket
Sign inDemoInstall

@akiroz/pubsub-rpc

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @akiroz/pubsub-rpc

[![](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)


Version published
Maintainers
1
Install size
644 kB
Created

Readme

Source

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.

FAQs

Last updated on 23 Sep 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc