DNode is an asynchronous object-oriented RPC system for node.js that lets you call remote functions.
(From the Readme at DNode on Github)
DNode works over network sockets and even in the browser with socket.io.
Plus, there are dnode implementations for perl, ruby, and java, so you can glue together all your backend processes swimmingly.
How it Works
When you throw an object at dnode, a recursive traversal scrubs out all of the
function
objects nested in your data structure and a secondary data structure
is sent along with remote requests that creates shim functions that create RPC
calls back to the side where the functions were originally defined.
When you call a remote function, the same recursive traversal trick happens to the arguments you pass along, so you can pass callbacks to your remote functions that actually call you back over the wire when the remote side calls the shim function on the other end.
Basically, dnode lets you call remote functions as if they were defined locally
without using eval()
or Function.prototype.toString()
.
The only catch is that because the function calls are traveling down the high-latency network, the return values of your functions are ignored. Use continuation-passing style instead!
More features:
symmetric design: both sides of the connection can host up methods for the other side to call
use tcp streams or websockets courtesy of socket.io! (see below, just throw a webserver at
listen()
)
read more
Roll your own PubSub with DNode (Note: EventEmitters are no longer exported directly, use browserify to get them back)
DNode: Asynchronous Remote Method Invocation for Node.js and the Browser