summaryrefslogtreecommitdiffstats
path: root/src/jaegertracing/thrift/lib/nodejs/examples/httpClient.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/jaegertracing/thrift/lib/nodejs/examples/httpClient.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/jaegertracing/thrift/lib/nodejs/examples/httpClient.js b/src/jaegertracing/thrift/lib/nodejs/examples/httpClient.js
new file mode 100644
index 000000000..19cc0c362
--- /dev/null
+++ b/src/jaegertracing/thrift/lib/nodejs/examples/httpClient.js
@@ -0,0 +1,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);
+});
+
+