Skip to content

romulka/nodejs-light_rpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple RPC server/client based on NodeJS native 'net' lib sockets.

Tested with nodejs >= 0.4.2

Sample server looks like:

var light_rpc = require('./index.js');
var port = 5556;

var rpc = new light_rpc({
	combine: function(a, b, callback){
		callback(a + b);
	},
	multiply: function(t, cb){
		cb(t*2);
	}
});
rpc.listen(port);

Sample client:

rpc.connect(5556, 'localhost', function(remote, conn){
	remote.combine(1, 2, function(res){
		if(res != 3){
			console.log('ERROR', res);
		}

		conn.destroy();
		conn.end();
	});
});

About

NodeJS RPC server/client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published