sproc
This module is useful when you want to spawn a single daemon and be able to connect to it from other processes.
workflow:
- attempt to connect to daemon
- if connection fails, spawn daemon (return to first step)
- upon connection, callback with a stream
Install
npm install sproc
Use
daemon.js
// echo daemon var clients = 0; module { clients++; stream; stream; stream;};
main.js
var sproc = ; ;
options
port
- port to use for listening/connecting (default: 4499)keepProcessReference
- do not detatch from the daemon (default: false)log
- a function (optional)
License
MIT