脐带node.js进程之间的双向rpc。




// 'Server'

var umbilical = require('umbilical');

var server = umbilical.endpoint({ port: 1337 }, {

add: function (a, b, cb) { cb(null, a + b); },

mul: function (a, b, cb) { cb(null, a * b); }

}, function (client) {

client.request('hello', function (er, res) {

console.log(res);

});

});