# rpc_js_sample **Repository Path**: dormi330/rpc_js_sample ## Basic Information - **Project Name**: rpc_js_sample - **Description**: javascript rpc 的一个简单demo,从github来的 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2015-01-29 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 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(); }); });