A Node.js module called dnode: dnode-protocol github repo.
Here is what it is. This is the server.js:
var dnode = require('dnode');
var server = dnode({
mul : function (n, m, cb) { cb(n * m) }
});
server.listen(5050);
And here is the client.js:
var dnode = require('dnode');
dnode.connect(5050, function (remote) {
remote.mul(10, 20, function (n) {
console.log('10 * 20 = ' + n);
});
});
Now when you run client.js, you get the output:
$ node client.js 200So the potential for this is great. Computing most things server side will greatly free up client side operations.
No comments:
Post a Comment