Socket
Socket
Sign inDemoInstall

@arcblock/event-hub

Package Overview
Dependencies
72
Maintainers
4
Versions
242
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @arcblock/event-hub

A nodejs module for local and remote Inter Process Event


Version published
Maintainers
4
Install size
3.45 MB
Created

Readme

Source

Event Hub

A module for local and remote Inter Process Event

image

Usage

Install

yarn add @arcblock/event-hub

Server

process.env.ABT_NODE_EVENT_PORT=8888;

require('@arcblock/event-hub/lib/server.js);

Client

// process 1

const Client = require('@arcblock/event-hub/lib/client');

const port = ''; // event-hub server port
const did = ''; // your did
const sk = ''; // your sk

const client = new Client({ port, did, sk, autoConnect: true });

const data = { foo: bar };

client.broadcast('my-event', data);
// process 2

const Client = require('@arcblock/event-hub/lib/client');

const port = ''; // event-hub server port
const did = ''; // your did
const sk = ''; // your sk

const client = new Client({ port, did, sk, autoConnect: true });

client.on('my-event', (data) => {
  // handle data
});

FAQs

Last updated on 09 May 2024

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