README
rpcSend
Intended to be a one to one relationship for a rpc method, so for every rpc method you should have a new instace of RPCSend.
const someRPCService = new RPCSend('add', 'http://localhost:3000'); // just hostname
const someOtherRPCService = new RPCSend('substract', null, 3000); // just a port -- defaults to localhost
const someLastRPCService = new RPCSend('transform', '0.0.0.0', 3000); // or both...
const someLoggedRPCService = new RPCSend('unicornBuilder', null, 3000, logger); // supports custom logging -- defaults to process
const continuousOptions = {
args: ['arguments', ['in', 'a'], true, 'format'],
trysBeforeError: 5, // how many times we try before we log something
timeout: 3000, // how long to wait between each recursive call
cb(err, somethingElse, itReallyDependsOnYourRPCServer) { // optional, otherwise it returns a promise according to (err, rpcErr, result) signature
... stuff ...
}
}
someRPCService.run(continuousOptions).then(...stuff).catch(...handle);