umbilical

0.0.4 • Public • Published

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

Dependents (4)

Package Sidebar

Install

npm i umbilical

Weekly Downloads

0

Version

0.0.4

License

MIT

Last publish

Collaborators

  • marcelklehr