mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 10:48:51 +00:00
779b9ac2ef
Client: node Patch: Randy Abernethy Clean up of many jshint warnings/errors, jsdoc for HttpConnect, added support for https and Python to HttpConnect, added tests for HttpConnect with https and promises.
24 lines
561 B
JavaScript
24 lines
561 B
JavaScript
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);
|
|
});
|
|
|
|
|