umbilical
v0.0.4
Published
Bidirectional rpc over tpc for inter-process communication pruposes and other stuff.
Downloads
57
Maintainers
Readme
umbilical
Bidirectional rpc between your node.js processes.
npm install umbilical
// "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)
})
})
// "Client"
var umbilical = require('umbilical')
var server = umbilical({port: 1337},
{ hello: function(cb) {
cb(null, 'oh, be quiet, already!')
}
})
server.request('mul', 5, 6, function(er, res) {
if(er) throw new er
console.log8('5 * 6 =', res)
})
License
Copyright (c) Marcel Klehr
MIT License