Package Exports
- @hoobs/ipc
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@hoobs/ipc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
IPC
A library for local interprocess communications on unix based systems.
Usage
Server
import { IPCServer, IPCOptions } from "../index";
const options: IPCOptions = {
id: "test",
maxConnections: 100,
};
const server = new IPCServer({ id: "test", maxConnections: 200 });
server.route("hello", (request, response) => {
response.send({
message: `Hello ${request?.params?.name}`,
});
});
server.start();
Client
import { IPCClient } from "../index";
const client = new IPCClient({ id: "test" });
client.fetch("hello", { name: "Luke Skywalker" }).then((response) => {
console.log(response);
});
Options
variable | Required | description |
---|---|---|
id | Yes | a unique name for the socket |
root | No | the path to store the Unix sock file, default is the app root |
namespace | No | adds a domain to the sock files |
encoding | No | text encoding for socket messages, default is utf8 |
maxConnections | No | this is the max number of connections allowed to a socket, default is 100 (server only) |
Installation
Then you can install this module into your project.
yarn add @hoobs/ipc
Legal
This is a modified project orginally wrote by Brandon Nozaki Miller.
HOOBS and the HOOBS logo are registered trademarks of HOOBS Inc. Copyright (C) 2020 HOOBS Inc. All rights reserved.