net-fn

'Inter-process communication' Allows you to communicate with background processes over the 'net' module.

Usage no npm install needed!

<script type="module">
  import netFn from 'https://cdn.skypack.dev/net-fn';
</script>

README

net-fn: a Node.js Inter Process Communication library

npm-version npm-week-downloads

'Inter-process communication' Allows you to communicate with background processes over the 'net' module. The callback APIs perform all operations asynchronously, without blocking the event loop, then invoke a callback function upon completion or error.

Installing

npm install net-fn

Usage example

var net_fn = require("net-fn");
var bg_module = require("your-background-module");
var port = 8021;

var worker = net_fn.tryToRunServer(bg_module, port, "localhost");
var bgModule = net_fn.connect(bg_module, port, "localhost");

// the background module is ready for use
bgModule.fn(arg, function callback(err, result){
    ...
});

License

MIT

Copyright (c) 2021 Manuel Lõhmus manuel@hauss.ee