ipc-rpc
RPC over process.send
, including support for sending handles.
Both sides of the pipe can be both clients and servers.
Usage
Set up a basic server that responds to status requests with "OK!":
functions = : cb null"OK!" rpc = processfunctions:functionstimeout:500
On the client-side:
rpc = server if err # probably didn't pass in something with `.send` as server throw err # ready rpcrequest "status"msg:"whatever" # err should be null and result should be "OK!"
Requests optionally take a handle as their third argument, before the callback.
Motivation
In StreamMachine, this library is used to facilitate handoffs of server and listener data during seamless restarts.
Example call (found here in StreamMachine):
for source in sg_streamsources if source_shouldHandoff do @loginfo "Sending StreamGroup source /" rpcrequest "group_source" group: sgkey type: sourceHANDOFF_TYPE opts: format:sourceoptsformatuuid:sourceuuidsource_ip:sourceoptssource_ip sourceoptssock @logerror "Error sending group source /: " if err af