Hydra-plugin-RPC
Create and consume remote procedure calls in hydra with ease.
Install
$ npm i --save hydra-plugin-rpc
Use
Two methods are added to the hydra instance to add or consume methods
// hydra.methods(obj: Object);// Object has keys of method names and values of functions.hydra;
// hydra.call(methodName: String, ...arguments) => Promise// First argument is method name.// Remaining arguments are sent to method (must be serializable).// Returns a promise with the result.hydra;
Example
// Service1.jsconst hydra = ;const HydraRPC = ;const Promise = ; hydra; hydra;
// Service2.js (even works on separate machines!)const hydra = ;const HydraRPC = ; hydra; hydra;