Skip to content
Fast & simple IPC (Inter-Process Communication) server/client written on native net module
TypeScript JavaScript
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitattributes
.gitignore
LICENSE
README.md
index.d.ts
index.js
package-lock.json
package.json
plog
test.d.ts
test.js
tsconfig.json

README.md

fast-ipc

Fast & simple IPC (Inter-Process Communication) server/client build on native net module

Installation

npm i fast-ipc

Usage

Server

import { server } from 'fast-ipc';

const ipcServer =
    new server('example')
        .on('msg', (req) => {
            console.log(req);
            //[1, 2, 3, 4, 5]
        })
        .on('ping', (req, res) => {
            res('pong!');
        })
        .on('event', (req, res) => {
            res({
                data: req,
                timestamp: Date.now()
            });
        });

Client

import { client } from 'fast-ipc';

const ipcClinet = new client('example');

ipcClinet.send('msg', [1, 2, 3, 4, 5]);

ipcClinet.send('ping', [], (msg) => {
    console.log(msg);
    //pong!
});

ipcClinet.send('event', [1, 2, 3, 'testing'], (msg) => {
    console.log(msg);
    //{ data: [ '1', '2', '3', 'testing' ], timestamp: 1577025604487 }
});
You can’t perform that action at this time.