DataPath

@xaymar/datapath

DataPath is an IPC library for fast and predictable messaging between processes on the same machine made in C++11 (or newer). Designed from the ground up to care about the worst case it is able to outperform or match existing solutions such as boost interprocess, libuv, Mojo and others. It allows for packets from a few bytes all the way to many megabytes between one server and any number of clients. The exact implementation varies by platform and makes use of the best measured available systems.

These are the official bindings for DataPath

Features

Node specific Features

Node specific Differences

Usage

npm install @xaymar/datapath
const datapath = require('@xaymar/datapath');
// or: import { host, connect } from '@xaymar/datapath';

// Server: echo every message.
const server = datapath.host('my-service', (socket) => {
    socket.on('message', (data) => socket.send(data));
    socket.on('close', (reason) => console.log('client left:', reason));
});

// Client.
const socket = await datapath.connect('my-service');
socket.on('message', (data) => console.log(data.toString()));
socket.send('hello');            // string (UTF-8), Buffer, any TypedArray, DataView or ArrayBuffer
socket.sendv(['he', 'llo']);     // one message from several parts, without joining them first
socket.close();
server.close();

API

License

BSD 3-Clause License, see LICENSE.

View this page on GitHub