Skip to content

davvo/pig-rpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pig-rpc

simple rpc using zeromq and pigato

Prerequisites

You need to install zeromq. On OSX you can use homebrew:

> brew update
> brew install zeromq 

##Install

> npm install pig-rpc

Example

Broker

var pig = require('pig-rpc')('tcp://*:55555');

pig.broker(function () {
  console.log('Broker started.');
});

Worker

var pig = require('pig-rpc')('tcp://localhost:55555');

pig.handle('square', function (num, callback) {
  callback(Math.pow(num, 2));
});

Client

var pig = require('pig-rpc')('tcp://localhost:55555');

pig.call('square', 9, function (err, res) {
  console.log('The square of 9 is', res);
});

About

simple rpc using zeromq and pigato

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published