blob: 155b5f489154ad3da817d5386f3af6808597d552 [file] [log] [blame]
Cameron Martincaef0ed2025-01-15 11:58:39 +01001var thrift = require("thrift");
2var helloSvc = require("./gen-nodejs/HelloSvc.js");
ra779b9ac2014-04-23 20:04:23 -07003
4var options = {
Cameron Martincaef0ed2025-01-15 11:58:39 +01005 transport: thrift.TBufferedTransport,
6 protocol: thrift.TJSONProtocol,
7 path: "/hello",
8 headers: { Connection: "close" },
9 https: false,
ra779b9ac2014-04-23 20:04:23 -070010};
11
12var connection = thrift.createHttpConnection("localhost", 9090, options);
13var client = thrift.createHttpClient(helloSvc, connection);
14
Cameron Martincaef0ed2025-01-15 11:58:39 +010015connection.on("error", function (err) {
16 console.log("Error: " + err);
ra779b9ac2014-04-23 20:04:23 -070017});
18
Cameron Martincaef0ed2025-01-15 11:58:39 +010019client.hello_func(function (error, result) {
20 console.log("Msg from server: " + result);
ra779b9ac2014-04-23 20:04:23 -070021});