THRIFT-4437: JavaScript WebSocket - fix duplicate callbacks and enable ThriftWS test suite
Client: js
This closes #1450
diff --git a/lib/js/src/thrift.js b/lib/js/src/thrift.js
index 1a11871..5d420a2 100644
--- a/lib/js/src/thrift.js
+++ b/lib/js/src/thrift.js
@@ -572,18 +572,11 @@
var clientCallback = callback;
return function(msg) {
self.setRecvBuffer(msg);
- clientCallback();
+ if (clientCallback) {
+ clientCallback();
+ }
};
}()));
- if(callback) {
- this.callbacks.push((function() {
- var clientCallback = callback;
- return function(msg) {
- self.setRecvBuffer(msg);
- clientCallback();
- };
- }()));
- }
} else {
//Queue the send to go out __onOpen
this.send_pending.push({