I am running in a problem with Javascript and the library ZeroRPC I created a server this way:
Server:
var zerorpc = require('zerorpc');
var server = new zerorpc.Server({
hello: function(name, reply) {
reply(null, 'Hello, ' + name);
}
});
server.bind('tcp://0.0.0.0:4242');
Client
var zerorpc = require('zerorpc');
var client = new zerorpc.Client();
client.connect('tcp://127.0.0.1:4242');
var result = client.invoke('hello', 'RPC', function(error, res, more) {
//console.log(res); //WORKS ! logs 'Hello, RPC'
return res; //returns undefined
});
console.log(result); //undefined :(
I don't understand why I cannot return this value from the client.invoke call. Am I missing something out ?