IPC-Link Core
IPC-Link Core is a lower level version of IPC-Link that is lightning fast and operates with raw buffers as opposed to sending buffered stringified JSON objects. This library has no dependencies and uses built-in modules (net
, events
...) to operate.
In IPC-Link Core, you have "nodes", which can either create a server (and receive messages) or connect to other servers, even both at the same time. Additionally, you have Node#sendTo(socket, data);
which will wait for the socket to reply back.
Usage
Check the examples here for working micro IPC-Link Core applications.
hello.js
// This example must be run before interactive/world, since this serves the// IPC server the other sockets connect to.const Node = ; const node = 'hello' ;
world.js
// This example depends on hello.js to be running in another process.// This Node is a socket that replies to hello.js with "world!" when it// receives "Hello".const Node = ; const node = 'world' ; node ;
The differences with IPC-Link are:
- IPC-Link Core does not rely on node-ipc, but rather uses
net.Socket
,net.Server
andevents.EventEmitter
. - IPC-Link Core does not use JSON objects: it uses buffers with headers.
- IPC-Link Core does not abstract
net.Socket#connect
nornet.Server#listen
, as opposed to what node-ipc does. - IPC-Link Core does not send a message to a socket if it's not connected, you must connect first (in node-ipc, it attempts to connect using the name, which breaks in many cases and leads to unexpected behaviour).