FLYBYME edited this page Oct 28, 2011 · 2 revisions
Clone this wiki locally

Welcome to rpc-socket!


When I started this project it was to deal with the object to string over a socket problem. I wanted something that I didn't have to think about when i came to socket sensitization of objects. Over time the project has changed into more of a rpc-json type framework.


  • Easy was to expose methods both on the client and server.
  • Highly extensible through the module system.
  • Slave over TCP.
  • Master over TCP.


Just a few methods. I plan on making better docs soon.


You can install it through git clone of npm. Through npm.

npm install rpc-socket

Through git

git clone git://github.com/FLYBYME/rpc-socket.git
cd rpc-socket

Request it like so.

var rpcSocket = request('rpc-socket');

or if you gitted it.

var rpcSocket = request('./index');

Master & Slave

As of October 27, 2011 Im a bit lost on how to do the master slave. What I what is some kind of bootstrap for the master and stave that would allow both to be in some kind of meshed network. automatically joining a predefine network of masters and slaves. NOTE: Any advice on this would be really cool.

var server = new rpcSocket.Master(port, host, modules);


For both master and slave the modules are loaded the same.


module.exports = function(rpc) {
	rpc.expose('hello-world', {
		Q: function(a) {
			this.set('A', 'hello-world');
			this.set('sent', a);

How you would call hello-world

rpc.makeCall('hello-world.Q', ['some text, object or array'], function(err, result, id){
		console.log(err);//should not have an error
	console.log(result);//{'A':'hello-world','sent': 'some text, object or array'}