npm.io
1.0.8 • Published 6 years ago

ipc-protocol

Licence
MIT
Version
1.0.8
Deps
1
Size
8 kB
Vulns
1
Weekly
0

ipc-protocol

Provides simple interprocess communication, through TCP.

Installation

Using npm:

npm install ipc-protocol

In Node.js:

// Import the ipc-protocol and return an instance of the client/server
const ipcProtocol = require('ipc-protocol').getIpc(constants.clientPort, constants.serverPort, '127.0.0.1');

// A send example:
ipcProtocol.send({
    Command: 'command',
    Payload: null
}, (err) => {
    console.error(err);
});

// A listen example:
main.listen((a, head) => {
    console.log('Received: ' + a);

    // Sending a callback with the same headers
    main.send({
        Command: 'node-callback',
        Payload: null
    }, (err) => {
        console.error(err);
    }, head)
});

Note:

This solution integrates perfectly with the .NET Core solution IpcProtocol.Core

Keywords