Repository: thrift Updated Branches: refs/heads/master 43509df15 -> 96f4f07be
http://git-wip-us.apache.org/repos/asf/thrift/blob/96f4f07b/lib/nodejs/lib/thrift/web_server.js ---------------------------------------------------------------------- diff --git a/lib/nodejs/lib/thrift/web_server.js b/lib/nodejs/lib/thrift/web_server.js index c575c6d..68eb94d 100644 --- a/lib/nodejs/lib/thrift/web_server.js +++ b/lib/nodejs/lib/thrift/web_server.js @@ -24,11 +24,12 @@ var fs = require("fs"); var crypto = require("crypto"); var MultiplexedProcessor = require('./multiplexed_processor').MultiplexedProcessor; -var TTransport = require('./transport'); -var TBufferedTransport = require('./transport').TBufferedTransport; -var TBinaryProtocol = require('./protocol').TBinaryProtocol; -// WSFrame constructor and prototype +var TBufferedTransport = require('./buffered_transport'); +var TBinaryProtocol = require('./binary_protocol'); +var InputBufferUnderrunError = require('./input_buffer_underrun_error'); + +// WSFrame constructor and prototype ///////////////////////////////////////////////////////////////////// /** Apache Thrift RPC Web Socket Transport @@ -44,11 +45,11 @@ var TBinaryProtocol = require('./protocol').TBinaryProtocol; * - Opcode is 1(TEXT) for TJSONProtocol and 2(BIN) for TBinaryProtocol * - Mask Present bit is 1 sending to-server and 0 sending to-client * - Payload Len: - * + If < 126: then represented directly + * + If < 126: then represented directly * + If >=126: but within range of an unsigned 16 bit integer - * then Payload Len is 126 and the two following bytes store + * then Payload Len is 126 and the two following bytes store * the length - * + Else: Payload Len is 127 and the following 8 bytes store the + * + Else: Payload Len is 127 and the following 8 bytes store the * length as an unsigned 64 bit integer * - Masking key is a 32 bit key only present when sending to the server * - Payload follows the masking key or length @@ -73,9 +74,9 @@ var TBinaryProtocol = require('./protocol').TBinaryProtocol; * +---------------------------------------------------------------+ */ var wsFrame = { - /** Encodes a WebSocket frame + /** Encodes a WebSocket frame * - * @param {Buffer} data - The raw data to encode + * @param {Buffer} data - The raw data to encode * @param {Buffer} mask - The mask to apply when sending to server, null for no mask * @param {Boolean} binEncoding - True for binary encoding, false for text encoding * @returns {Buffer} - The WebSocket frame, ready to send @@ -83,18 +84,18 @@ var wsFrame = { encode: function(data, mask, binEncoding) { var frame = new Buffer(wsFrame.frameSizeFromData(data, mask)); //Byte 0 - FIN & OPCODE - frame[0] = wsFrame.fin.FIN + + frame[0] = wsFrame.fin.FIN + (binEncoding ? wsFrame.frameOpCodes.BIN : wsFrame.frameOpCodes.TEXT); //Byte 1 or 1-3 or 1-9 - MASK FLAG & SIZE var payloadOffset = 2; if (data.length < 0x7E) { frame[1] = data.length + (mask ? wsFrame.mask.TO_SERVER : wsFrame.mask.TO_CLIENT); } else if (data.length < 0xFFFF) { - frame[1] = 0x7E + (mask ? wsFrame.mask.TO_SERVER : wsFrame.mask.TO_CLIENT); + frame[1] = 0x7E + (mask ? wsFrame.mask.TO_SERVER : wsFrame.mask.TO_CLIENT); frame.writeUInt16BE(data.length, 2, true); payloadOffset = 4; } else { - frame[1] = 0x7F + (mask ? wsFrame.mask.TO_SERVER : wsFrame.mask.TO_CLIENT); + frame[1] = 0x7F + (mask ? wsFrame.mask.TO_SERVER : wsFrame.mask.TO_CLIENT); frame.writeUInt32BE(0, 2, true); frame.writeUInt32BE(data.length, 6, true); payloadOffset = 10; @@ -116,18 +117,18 @@ var wsFrame = { * @class * @name WSDecodeResult * @property {Buffer} data - The decoded data for the first ATRPC message - * @property {Buffer} mask - The frame mask - * @property {Boolean} binEncoding - True if binary (TBinaryProtocol), + * @property {Buffer} mask - The frame mask + * @property {Boolean} binEncoding - True if binary (TBinaryProtocol), * False if text (TJSONProtocol) - * @property {Buffer} nextFrame - Multiple ATRPC messages may be sent in a + * @property {Buffer} nextFrame - Multiple ATRPC messages may be sent in a * single WebSocket frame, this Buffer contains * any bytes remaining to be decoded * @property {Boolean} FIN - True is the message is complete */ - - /** Decodes a WebSocket frame + + /** Decodes a WebSocket frame * - * @param {Buffer} frame - The raw inbound frame, if this is a continuation + * @param {Buffer} frame - The raw inbound frame, if this is a continuation * frame it must have a mask property with the mask. * @returns {WSDecodeResult} - The decoded payload * @@ -163,7 +164,7 @@ var wsFrame = { result.mask = new Buffer(4); frame.copy(result.mask, 0, dataOffset, dataOffset + 4); dataOffset += 4; - } + } //Payload result.data = new Buffer(len); frame.copy(result.data, 0, dataOffset, dataOffset+len); @@ -183,7 +184,7 @@ var wsFrame = { return result; }, - /** Masks/Unmasks data + /** Masks/Unmasks data * * @param {Buffer} data - data to mask/unmask in place * @param {Buffer} mask - the mask @@ -203,7 +204,7 @@ var wsFrame = { * @param {Boolean} mask - true if a mask will be sent (TO_SERVER) */ frameSizeFromData: function(data, mask) { - var headerSize = 10; + var headerSize = 10; if (data.length < 0x7E) { headerSize = 2; } else if (data.length < 0xFFFF) { @@ -237,15 +238,15 @@ var wsFrame = { /** * @class * @name ServerOptions - * @property {array} cors - Array of CORS origin strings to permit requests from. - * @property {string} files - Path to serve static files from, if absent or "" + * @property {array} cors - Array of CORS origin strings to permit requests from. + * @property {string} files - Path to serve static files from, if absent or "" * static file service is disabled. * @property {object} headers - An object hash mapping header strings to header value - * strings, these headers are transmitted in response to + * strings, these headers are transmitted in response to * static file GET operations. - * @property {object} services - An object hash mapping service URI strings + * @property {object} services - An object hash mapping service URI strings * to ServiceOptions objects - * @property {object} tls - Node.js TLS options (see: nodejs.org/api/tls.html), + * @property {object} tls - Node.js TLS options (see: nodejs.org/api/tls.html), * if not present or null regular http is used, * at least a key and a cert must be defined to use SSL/TLS * @see {@link ServiceOptions} @@ -254,19 +255,19 @@ var wsFrame = { /** * @class * @name ServiceOptions - * @property {object} transport - The layered transport to use (defaults + * @property {object} transport - The layered transport to use (defaults * to TBufferedTransport). - * @property {object} protocol - The serialization Protocol to use (defaults to + * @property {object} protocol - The serialization Protocol to use (defaults to * TBinaryProtocol). - * @property {object} processor - The Thrift Service class/processor generated - * by the IDL Compiler for the service (the "cls" + * @property {object} processor - The Thrift Service class/processor generated + * by the IDL Compiler for the service (the "cls" * key can also be used for this attribute). * @property {object} handler - The handler methods for the Thrift Service. */ -/** +/** * Create a Thrift server which can serve static files and/or one or - * more Thrift Services. + * more Thrift Services. * @param {ServerOptions} options - The server configuration. * @returns {object} - The Apache Thrift Web Server. */ @@ -290,7 +291,7 @@ exports.createWebServer = function(options) { var services = options.services; for (var uri in services) { var svcObj = services[uri]; - + //Setup the processor if (svcObj.processor instanceof MultiplexedProcessor) { //Multiplex processors have pre embedded processor/handler pairs, save as is @@ -298,9 +299,9 @@ exports.createWebServer = function(options) { } else { //For historical reasons Node.js supports processors passed in directly or via the // IDL Compiler generated class housing the processor. Also, the options property - // for a Processor has been called both cls and processor at different times. We + // for a Processor has been called both cls and processor at different times. We // support any of the four possibilities here. - var processor = (svcObj.processor) ? (svcObj.processor.Processor || svcObj.processor) : + var processor = (svcObj.processor) ? (svcObj.processor.Processor || svcObj.processor) : (svcObj.cls.Processor || svcObj.cls); //Processors can be supplied as constructed objects with handlers already embedded, // if a handler is provided we construct a new processor, if not we use the processor @@ -314,7 +315,7 @@ exports.createWebServer = function(options) { svcObj.transport = svcObj.transport ? svcObj.transport : TBufferedTransport; svcObj.protocol = svcObj.protocol ? svcObj.protocol : TBinaryProtocol; } - + //Verify CORS requirements function VerifyCORSAndSetHeaders(request, response) { if (request.headers.origin && options.cors) { @@ -333,7 +334,7 @@ exports.createWebServer = function(options) { //Allow, CORS is not in use return true; } - + //Handle OPTIONS method (CORS) /////////////////////////////////////////////////// @@ -345,8 +346,8 @@ exports.createWebServer = function(options) { } response.end(); } - - + + //Handle POST methods (TXHRTransport) /////////////////////////////////////////////////// function processPost(request, response) { @@ -365,7 +366,7 @@ exports.createWebServer = function(options) { response.end(); return; } - + //Process XHR payload request.on('data', svc.transport.receiver(function(transportWithData) { var input = new svc.protocol(transportWithData); @@ -383,7 +384,7 @@ exports.createWebServer = function(options) { svc.processor.process(input, output); transportWithData.commitPosition(); } catch (err) { - if (err instanceof TTransport.InputBufferUnderrunError) { + if (err instanceof InputBufferUnderrunError) { transportWithData.rollbackPosition(); } else { response.writeHead(500); @@ -401,7 +402,7 @@ exports.createWebServer = function(options) { if (!baseDir || "" === baseDir) { response.writeHead(404); response.end(); - return; + return; } //Verify CORS requirements @@ -420,11 +421,11 @@ exports.createWebServer = function(options) { response.end(); return; } - + if (fs.statSync(filename).isDirectory()) { filename += '/index.html'; } - + fs.readFile(filename, "binary", function(err, file) { if (err) { response.writeHead(500); @@ -466,7 +467,7 @@ exports.createWebServer = function(options) { transportWithData.commitPosition(); } catch (err) { - if (err instanceof TTransport.InputBufferUnderrunError) { + if (err instanceof InputBufferUnderrunError) { transportWithData.rollbackPosition(); } else { @@ -485,7 +486,7 @@ exports.createWebServer = function(options) { } //Wire up listeners for upgrade(to WebSocket) & request methods for: - // - GET static files, + // - GET static files, // - POST XHR Thrift services // - OPTIONS CORS requests server.on('request', function(request, response) { http://git-wip-us.apache.org/repos/asf/thrift/blob/96f4f07b/lib/nodejs/lib/thrift/ws_connection.js ---------------------------------------------------------------------- diff --git a/lib/nodejs/lib/thrift/ws_connection.js b/lib/nodejs/lib/thrift/ws_connection.js index 54dd936..0812934 100644 --- a/lib/nodejs/lib/thrift/ws_connection.js +++ b/lib/nodejs/lib/thrift/ws_connection.js @@ -23,6 +23,12 @@ var thrift = require('./thrift'); var ttransport = require('./transport'); var tprotocol = require('./protocol'); +var TBufferedTransport = require('./buffered_transport'); +var TJSONProtocol = require('./json_protocol'); +var InputBufferUnderrunError = require('./input_buffer_underrun_error'); + +var createClient = require('./create_client'); + /** * @class * @name WSConnectOptions @@ -77,12 +83,12 @@ var WSConnection = exports.WSConnection = function(host, port, options) { this.host = host; this.port = port; this.secure = this.options.secure || false; - this.transport = this.options.transport || ttransport.TBufferedTransport; - this.protocol = this.options.protocol || tprotocol.TJSONProtocol; + this.transport = this.options.transport || TBufferedTransport; + this.protocol = this.options.protocol || TJSONProtocol; this.path = this.options.path; this.send_pending = []; - //The sequence map is used to map seqIDs back to the + //The sequence map is used to map seqIDs back to the // calling client in multiplexed scenarios this.seqId2Service = {}; @@ -108,7 +114,7 @@ WSConnection.prototype.__onOpen = function() { var self = this; this.emit("open"); if (this.send_pending.length > 0) { - //If the user made calls before the connection was fully + //If the user made calls before the connection was fully //open, send them now this.send_pending.forEach(function(data) { self.socket.send(data); @@ -132,12 +138,12 @@ WSConnection.prototype.__decodeCallback = function(transport_with_data) { //The Multiplexed Protocol stores a hash of seqid to service names // in seqId2Service. If the SeqId is found in the hash we need to // lookup the appropriate client for this call. - // The client var is a single client object when not multiplexing, + // The client var is a single client object when not multiplexing, // when using multiplexing it is a service name keyed hash of client // objects. //NOTE: The 2 way interdependencies between protocols, transports, // connections and clients in the Node.js implementation are irregular - // and make the implementation difficult to extend and maintain. We + // and make the implementation difficult to extend and maintain. We // should bring this stuff inline with typical thrift I/O stack // operation soon. // --ra @@ -167,7 +173,7 @@ WSConnection.prototype.__decodeCallback = function(transport_with_data) { } } } catch (e) { - if (e instanceof ttransport.InputBufferUnderrunError) { + if (e instanceof InputBufferUnderrunError) { transport_with_data.rollbackPosition(); } else { throw e; @@ -183,8 +189,8 @@ WSConnection.prototype.__onData = function(data) { this.transport.receiver(this.__decodeCallback.bind(this))(buf); }; -WSConnection.prototype.__onMessage = function(evt) { +WSConnection.prototype.__onMessage = function(evt) { this.__onData(evt.data); }; @@ -230,7 +236,6 @@ WSConnection.prototype.close = function() { * Return URI for the connection * @returns {string} URI */ - WSConnection.prototype.uri = function() { var schema = this.secure ? 'wss' : 'ws'; var port = ''; @@ -276,21 +281,4 @@ exports.createWSConnection = function(host, port, options) { return new WSConnection(host, port, options); }; -/** - * Creates a new client object for the specified Thrift service. - * @param {object} cls - The module containing the service client - * @param {WSConnection} wsConnection - The connection to use. - * @returns {object} The client object. - * @see {@link createWSConnection} - */ -exports.createWSClient = function(cls, wsConnection) { - if (cls.Client) { - cls = cls.Client; - } - wsConnection.client = - new cls(new wsConnection.transport(undefined, function(buf) { - wsConnection.write(buf); - }), - wsConnection.protocol); - return wsConnection.client; -}; +exports.createWSClient = createClient; http://git-wip-us.apache.org/repos/asf/thrift/blob/96f4f07b/lib/nodejs/test/binary.test.js ---------------------------------------------------------------------- diff --git a/lib/nodejs/test/binary.test.js b/lib/nodejs/test/binary.test.js index 58feebf..dacadef 100644 --- a/lib/nodejs/test/binary.test.js +++ b/lib/nodejs/test/binary.test.js @@ -24,7 +24,7 @@ module.exports = testCase({ "Should read signed byte": function(test){ test.strictEqual(1, binary.readByte(0x01)); test.strictEqual(-1, binary.readByte(0xFF)); - + test.strictEqual(127, binary.readByte(0x7F)); test.strictEqual(-128, binary.readByte(0x80)); test.done(); @@ -123,11 +123,11 @@ module.exports = testCase({ test.deepEqual([0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55], binary.writeDouble([], 1/3)); // Min subnormal positive double - test.deepEqual([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01], binary.writeDouble([], 4.9406564584124654e-324)); + test.deepEqual([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01], binary.writeDouble([], 4.9406564584124654e-324)); // Min normal positive double - test.deepEqual([0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], binary.writeDouble([], 2.2250738585072014e-308)); + test.deepEqual([0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], binary.writeDouble([], 2.2250738585072014e-308)); // Max positive double - test.deepEqual([0x7f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff], binary.writeDouble([], 1.7976931348623157e308)); + test.deepEqual([0x7f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff], binary.writeDouble([], 1.7976931348623157e308)); test.done(); } }); http://git-wip-us.apache.org/repos/asf/thrift/blob/96f4f07b/lib/nodejs/test/client.js ---------------------------------------------------------------------- diff --git a/lib/nodejs/test/client.js b/lib/nodejs/test/client.js index 3b5f1cb..b8de7ce 100755 --- a/lib/nodejs/test/client.js +++ b/lib/nodejs/test/client.js @@ -58,7 +58,7 @@ if (program.protocol === "json") { protocol = thrift.TJSONProtocol; } else if (program.protocol === "compact") { protocol = thrift.TCompactProtocol; -} +} var transport = thrift.TBufferedTransport; if (program.transport === "framed") { @@ -88,7 +88,7 @@ connection.on('error', function(err) { var testDriver = ThriftTestDriver; if (program.promise) { testDriver = ThriftTestDriverPromise; -} +} testDriver(client, function (status) { console.log(status); connection.end(); http://git-wip-us.apache.org/repos/asf/thrift/blob/96f4f07b/lib/nodejs/test/http_client.js ---------------------------------------------------------------------- diff --git a/lib/nodejs/test/http_client.js b/lib/nodejs/test/http_client.js index 14c1a29..9ab05d8 100644 --- a/lib/nodejs/test/http_client.js +++ b/lib/nodejs/test/http_client.js @@ -41,7 +41,7 @@ program var protocol = thrift.TBinaryProtocol; if (program.protocol === "json") { protocol = thrift.TJSONProtocol; -} +} var transport = thrift.TBufferedTransport; if (program.transport === "framed") { @@ -58,7 +58,7 @@ var options = { if (program.ssl) { options.nodeOptions = { rejectUnauthorized: false }; options.https = true; -} +} var connection = thrift.createHttpConnection("localhost", 9090, options); @@ -72,7 +72,7 @@ var testDriver = ThriftTestDriver; if (program.promise) { console.log(" --Testing promise style client"); testDriver = ThriftTestDriverPromise; -} +} testDriver(client, function (status) { console.log(status); process.exit(0); http://git-wip-us.apache.org/repos/asf/thrift/blob/96f4f07b/lib/nodejs/test/http_server.js ---------------------------------------------------------------------- diff --git a/lib/nodejs/test/http_server.js b/lib/nodejs/test/http_server.js index f12e695..3519f4a 100644 --- a/lib/nodejs/test/http_server.js +++ b/lib/nodejs/test/http_server.js @@ -36,31 +36,31 @@ program var transport = thrift.TBufferedTransport; if (program.transport === "framed") { transport = thrift.TFramedTransport; -} +} var protocol = thrift.TBinaryProtocol; if (program.protocol === "json") { protocol = thrift.TJSONProtocol; -} +} var handler = ThriftTestHandler; if (program.promise) { handler = ThriftTestHandlerPromise; -} +} -var SvcOpt = { - handler: handler, - processor: ThriftTest, - protocol: protocol, - transport: transport -}; -var serverOpt = { services: { "/test": SvcOpt } }; +var SvcOpt = { + handler: handler, + processor: ThriftTest, + protocol: protocol, + transport: transport +}; +var serverOpt = { services: { "/test": SvcOpt } }; if (program.ssl) { serverOpt.tls = { key: fs.readFileSync(path.resolve(__dirname, 'server.key')), cert: fs.readFileSync(path.resolve(__dirname, 'server.crt')) }; } -thrift.createWebServer(serverOpt).listen(9090); +thrift.createWebServer(serverOpt).listen(9090); http://git-wip-us.apache.org/repos/asf/thrift/blob/96f4f07b/lib/nodejs/test/multiplex_client.js ---------------------------------------------------------------------- diff --git a/lib/nodejs/test/multiplex_client.js b/lib/nodejs/test/multiplex_client.js index 7b58205..7004f93 100644 --- a/lib/nodejs/test/multiplex_client.js +++ b/lib/nodejs/test/multiplex_client.js @@ -40,7 +40,7 @@ if (program.transport === "framed") { var protocol = thrift.TBinaryProtocol; if (program.protocol === "json") { protocol = thrift.TJSONProtocol; -} +} var options = { transport: transport, http://git-wip-us.apache.org/repos/asf/thrift/blob/96f4f07b/lib/nodejs/test/server.js ---------------------------------------------------------------------- diff --git a/lib/nodejs/test/server.js b/lib/nodejs/test/server.js index 378a6e2..b6d28c7 100755 --- a/lib/nodejs/test/server.js +++ b/lib/nodejs/test/server.js @@ -39,14 +39,14 @@ program var transport = thrift.TBufferedTransport; if (program.transport === "framed") { transport = thrift.TFramedTransport; -} +} var protocol = thrift.TBinaryProtocol; if (program.protocol === "json") { protocol = thrift.TJSONProtocol; } else if (program.protocol === "compact") { protocol = thrift.TCompactProtocol; -} +} var port = 9090; if (String(program.port) === "undefined"){ @@ -57,7 +57,7 @@ if (String(program.port) === "undefined"){ var handler = ThriftTestHandler; if (program.promise) { handler = ThriftTestHandlerPromise; -} +} var options = { protocol: protocol, http://git-wip-us.apache.org/repos/asf/thrift/blob/96f4f07b/lib/nodejs/test/test_handler.js ---------------------------------------------------------------------- diff --git a/lib/nodejs/test/test_handler.js b/lib/nodejs/test/test_handler.js index 09ff39f..fd25120 100644 --- a/lib/nodejs/test/test_handler.js +++ b/lib/nodejs/test/test_handler.js @@ -17,7 +17,7 @@ * under the License. */ -//This is the server side Node test handler for the standard +//This is the server side Node test handler for the standard // Apache Thrift test service. var ttypes = require('./gen-nodejs/ThriftTest_types'); http://git-wip-us.apache.org/repos/asf/thrift/blob/96f4f07b/lib/nodejs/test/thrift_test_driver.js ---------------------------------------------------------------------- diff --git a/lib/nodejs/test/thrift_test_driver.js b/lib/nodejs/test/thrift_test_driver.js index 5ddcb21..306f67d 100644 --- a/lib/nodejs/test/thrift_test_driver.js +++ b/lib/nodejs/test/thrift_test_driver.js @@ -17,13 +17,13 @@ * under the License. */ - // This is the Node.js test driver for the standard Apache Thrift - // test service. The driver invokes every function defined in the + // This is the Node.js test driver for the standard Apache Thrift + // test service. The driver invokes every function defined in the // Thrift Test service with a representative range of parameters. // // The ThriftTestDriver function requires a client object // connected to a server hosting the Thrift Test service and - // supports an optional callback function which is called with + // supports an optional callback function which is called with // a status message when the test is complete. var assert = require('assert'); @@ -31,15 +31,15 @@ var ttypes = require('./gen-nodejs/ThriftTest_types'); var Int64 = require('node-int64'); var ThriftTestDriver = exports.ThriftTestDriver = function(client, callback) { - + function checkRecursively(map1, map2) { if (typeof map1 !== 'function' && typeof map2 !== 'function') { if (!map1 || typeof map1 !== 'object') { //Handle int64 types (which use node-int64 in Node.js JavaScript) - if ((typeof map1 === "number") && (typeof map2 === "object") && + if ((typeof map1 === "number") && (typeof map2 === "object") && (map2.buffer) && (map2.buffer instanceof Buffer) && (map2.buffer.length === 8)) { var n = new Int64(map2.buffer); - assert.equal(map1, n.toNumber()); + assert.equal(map1, n.toNumber()); } else { assert.equal(map1, map2); } http://git-wip-us.apache.org/repos/asf/thrift/blob/96f4f07b/lib/nodejs/test/thrift_test_driver_promise.js ---------------------------------------------------------------------- diff --git a/lib/nodejs/test/thrift_test_driver_promise.js b/lib/nodejs/test/thrift_test_driver_promise.js index 74a91bd..9b991ef 100644 --- a/lib/nodejs/test/thrift_test_driver_promise.js +++ b/lib/nodejs/test/thrift_test_driver_promise.js @@ -202,9 +202,9 @@ client.testDouble(7.012052175215044) .fail(function() { assert(false); }); - -// TODO: add testBinary() - + +// TODO: add testBinary() + var out = new ttypes.Xtruct({ string_thing: 'Zero', byte_thing: 1, http://git-wip-us.apache.org/repos/asf/thrift/blob/96f4f07b/lib/nodejs/test/ws_client.js ---------------------------------------------------------------------- diff --git a/lib/nodejs/test/ws_client.js b/lib/nodejs/test/ws_client.js index 4573246..93b93b7 100644 --- a/lib/nodejs/test/ws_client.js +++ b/lib/nodejs/test/ws_client.js @@ -40,7 +40,7 @@ program var protocol = thrift.TBinaryProtocol; if (program.protocol === "json") { protocol = thrift.TJSONProtocol; -} +} var transport = thrift.TBufferedTransport; if (program.transport === "framed") { @@ -56,7 +56,7 @@ var options = { if (program.ssl) { options.wsOptions = { rejectUnauthorized: false }; options.secure = true; -} +} var connection = thrift.createWSConnection("localhost", 9090, options); connection.open(); @@ -71,7 +71,7 @@ var testDriver = ThriftTestDriver; if (program.promise) { console.log(" --Testing promise style client"); testDriver = ThriftTestDriverPromise; -} +} testDriver(client, function (status) { console.log(status); process.exit(0);
