summaryrefslogtreecommitdiffstats
path: root/src/jaegertracing/thrift/lib/nodejs/examples/httpClient.js
blob: 19cc0c362784b72d1f5b80676f0b7066eda42562 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var thrift = require('thrift');
var helloSvc = require('./gen-nodejs/HelloSvc.js');

var options = {
   transport: thrift.TBufferedTransport,
   protocol: thrift.TJSONProtocol,
   path: "/hello",
   headers: {"Connection": "close"},
   https: false
};

var connection = thrift.createHttpConnection("localhost", 9090, options);
var client = thrift.createHttpClient(helloSvc, connection);

connection.on("error", function(err) {
   console.log("Error: " + err);
});

client.hello_func(function(error, result) {
   console.log("Msg from server: " + result);
});