1.0.9 • Published 4 years ago

fast-ipc v1.0.9

Weekly downloads
6
License
ISC
Repository
github
Last release
4 years ago

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 }
});
1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago