THRIFT-2831:Eliminates dead code in node web server
Clinet: Node
Patch: Chi Vinh Le
Github Pull Request: This closes #270
diff --git a/lib/nodejs/lib/thrift/web_server.js b/lib/nodejs/lib/thrift/web_server.js
index 926b72c..5b2ebeb 100644
--- a/lib/nodejs/lib/thrift/web_server.js
+++ b/lib/nodejs/lib/thrift/web_server.js
@@ -27,7 +27,6 @@
var TTransport = require('./transport');
var TBufferedTransport = require('./transport').TBufferedTransport;
var TBinaryProtocol = require('./protocol').TBinaryProtocol;
-var TJSONProtocol = require('./protocol').TJSONProtocol;
// WSFrame constructor and prototype
/////////////////////////////////////////////////////////////////////
@@ -452,12 +451,11 @@
///////////////////////////////////////////////////
function processWS(data, socket, svc, binEncoding) {
svc.transport.receiver(function(transportWithData) {
- var binary = svc.protocol != TJSONProtocol;
var input = new svc.protocol(transportWithData);
var output = new svc.protocol(new svc.transport(undefined, function(buf) {
try {
var frame = wsFrame.encode(buf, null, binEncoding);
- socket.write(frame, null, binary);
+ socket.write(frame);
} catch (err) {
//TODO: Add better error processing
}
@@ -520,11 +518,10 @@
"\r\n");
//Handle WebSocket traffic
var data = null;
- var binary = svc.protocol != TJSONProtocol;
socket.on('data', function(frame) {
try {
while (frame) {
- var result = wsFrame.decode(frame, null, binary);
+ var result = wsFrame.decode(frame);
//Prepend any existing decoded data
if (data) {
if (result.data) {