@abtnode/event-hub 中文文档教程
ABT Node Event Hub
用于本地和远程进程间事件的模块
Usage
安装
yarn add @abtnode/event-hub
服务器
process.env.ABT_NODE_EVENT_PORT=8888;
require('@abtnode/event-hub/lib/server.js);
客户端
// process 1
process.env.ABT_NODE_EVENT_PORT = 8888;
const client = require('@abtnode/event-hub');
const data = { foo: bar };
client.broadcast('my-event', data);
// process 2
process.env.ABT_NODE_EVENT_PORT = 8888;
const client = require('@abtnode/event-hub');
client.on('my-event', (data) => {
// handle data
});
ABT Node Event Hub
A module for local and remote Inter Process Event
Usage
Install
yarn add @abtnode/event-hub
Server
process.env.ABT_NODE_EVENT_PORT=8888;
require('@abtnode/event-hub/lib/server.js);
Client
// process 1
process.env.ABT_NODE_EVENT_PORT = 8888;
const client = require('@abtnode/event-hub');
const data = { foo: bar };
client.broadcast('my-event', data);
// process 2
process.env.ABT_NODE_EVENT_PORT = 8888;
const client = require('@abtnode/event-hub');
client.on('my-event', (data) => {
// handle data
});