transparent-rpc
v1.1.0
Published
Easy to use async RPC for node, based on promises. Similar in spirit to Java RMI
Downloads
4
Readme
Transparent RPC
Automatic Proxy-based RPC for Node.js
How to use:
Add
$rpcMethods
property to the prototype of the classes you want to exportCreate
rpc.Socket
object wrapping the transport layer (an object-mode stream supporting arbitrary objects)const rpc = require('transparent-rpc'); let socket = new rpc.Socket(...);
Publish the first stub object:
let id = socket.addStub(mystub);
Transmit the ID of the stub out of band
Handle methods on the stub
Objects received by the stub will be proxies
Invoking a method on a proxy returns a promise for the execution of that method
To publish more objects, return them from the stub's methods, or pass them them to remote proxy methods