https://github.com/jutaz/rpc-in-harmony
RPC for node.js based on --harmony features
https://github.com/jutaz/rpc-in-harmony
Last synced: 2 months ago
JSON representation
RPC for node.js based on --harmony features
- Host: GitHub
- URL: https://github.com/jutaz/rpc-in-harmony
- Owner: jutaz
- License: apache-2.0
- Created: 2014-12-29T16:47:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-04T21:44:21.000Z (over 10 years ago)
- Last Synced: 2025-01-22T11:12:39.303Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 188 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
rpc-in-harmony
==============RPC for node.js based on --harmony features
#### Quick Example
Server
```js
var Server = require('./lib/server');var server = new Server({
fn: function (callback) {
callback('called');
}
}, {
auth: function (str) {
console.log(str); // Will output 'auth'
return true; // resolves or rejects auth
}
});server.listen(3000);
server.on('client:connect', function (client) {
client.remote.test(function (test) {
console.log(test); // Will output 'test'
});
setTimeout(function () {
client.stop();
}, 1000);
});```
Client
```js
var Client = require('./lib/client');var client = new Client({
test: function (callback) {
callback('test');
}
}, {
port: 3000,
auth: 'auth'
});client.on('connect', function (remote) {
remote.fn(function (a) {
console.log(a); // Will output 'Called'
});
});client.on('disconnect', function () {
console.log('Disconnected');
});```