Skip to content

Instantly share code, notes, and snippets.

@jiangzhuo
Created June 12, 2017 08:17
Show Gist options
  • Save jiangzhuo/98d97705064d7bbc5257d81bc59cde47 to your computer and use it in GitHub Desktop.
Save jiangzhuo/98d97705064d7bbc5257d81bc59cde47 to your computer and use it in GitHub Desktop.
hprose-nodejs-test
var hprose = require("./lib/hprose");
var client = hprose.Client.create("http://127.0.0.1:8080/");
var proxy = client.useService();
// console.log(proxy.hello)
// console.log(proxy.a.hello)
proxy.hello("world", function(result) {
console.log(result);
}, function(name, err) {
console.error(err);
});
var a = proxy.a.hello("shit", function(result) {
console.log(result);
}, function(name, err) {
console.error(err);
});
var hprose = require("./lib/hprose");
function hello(name) {
return "Hello " + name + "!";
}
var a = {
hello: function hello(name) {
return "Hello " + name + "!";
}
}
var server = hprose.Server.create("http://0.0.0.0:8080");
server.addFunction(hello);
server.addInstanceMethods(a,'a');
server.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment