Lestia is a library of Message-based RPC that can do callback.
Lestia is a library of Message-based RPC. It use JSON as function arguments serialized. It can pass function and can do callback!!
$ npm install lestia --save
There are some tests written by Mocha, Chai and Sinon.JS.
$ npm install
$ npm test
var lestia = require('lestia');
var client = lestia();client.on('send', function (msg) {
// Send message code
SomeMessageAPI.send(msg);
});
// Receive message code
SomeMessageAPI.addListener('receive', function (msg) {
client.emit('receive', msg);
});var func = client.get('function_name');
func('arg1', [ 1, 2, 3 ]);client.set('function_name', function (arg1, arg2) {
// Called by remote
});client.on('error', function (err) {
console.error(err);
});
client.on('log', function (log) {
console.log(log);
});MIT License
Copyright (c) 2015 Pine Mizune
