Are there any RPC modules which work with promises?
On the server I have functions which return promises. I would like to expose them for browser clients to call over websockts or fallbacks. I found some RPC libraries for example dnode, but they expect a callback as parameter.
I would like something like this:
Server:
rpc.expose({ timeout: function (time) { var d = Q.defer(); setTimeout(function () { d.resolve(); }, time); return d.promise; } });
Client:
rpc.timeout(2000).then(function() { console.log('done'); });
from RPC with promises for node.js
No comments:
Post a Comment