5 ms·
Rival node.js RPC project (dnode) author chiming in here. This is pretty neat and I like the emphasis on getting stuff going in as few lines as possible but I'
by substack 16y ago
Rival node.js RPC project (dnode) author chiming in here.
This is pretty neat and I like the emphasis on getting stuff going in as few lines as possible but I'm not convinced that return values and implicit result callbacks are the way to go for asynchronous requests, which is how I understand this project to work. Often when you want to make a remote call you'll be doing some I/O on the server side, which in node is asynchronous so you can't return right away. Passing along a callback from the client side works much better when the I/O actions have some values to call the client back with.
- ericz 16y agoHey substack, The implicit callback is definitely my least favorite part in building NowJS. You can still pass in an additional callback to do any asynchronous I/O. We're trying to find ways to make this experience better for the next version
- substack 16y agoThe solution I settled on for dnode is that a deep traversal finds all the functions in your argument list, pulls them out, and wraps them. This part of the protocol is a reusable module if you want to go with it: https://github.com/substack/dnode-protocol https://github.com/substack/dnode-protocol It's written for continuation-passing style but it shouldn't be too hard to retrofit it for other call styles if you want to preserve explicit returns for instance.
- chrisdew 16y agoI've just written JSON-RPC over SocketIO (for another project). I was going to open-source it. Is NowJS a superset of this? If so, I don't want to create noise by releasing a less-functional alternative.
- sthatipamala 16y agoIt's not quite JSON-RPC but it does the same thing.