Skip to content
/ ipc Public

An ipc-message classic model of node application framework for clusic

Notifications You must be signed in to change notification settings

clusic/ipc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

IPC channel process controller

IPC 信息通道管理模型。

Install

npm i @clusic/ipc

Usage

const IPC = require('@clusic/ipc');
module.exports = class Master extends IPC {
  constructor() {
    super();
    this.on('message', (msg, socket) => {
      // ...
    })
  }
}

API

ipc.register(name, agent)

const agent = ChildProcess.fork('./agent.js');
const IPC = require('@clusic/ipc');
const ipc = new IPC();
ipc.register('agent', agent);

ipc.send(to, action, body, socket)

const agent = ChildProcess.fork('./agent.js');
const IPC = require('@clusic/ipc');
const ipc = new IPC();
ipc.register('agent', agent);
ipc.send('master', 'test:action', { a: 1, b: 2 });

About

An ipc-message classic model of node application framework for clusic

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published