altangent / ccxws

WebSocket client for 38 cryptocurrency exchanges
MIT License
617 stars 186 forks source link

bittrex: crash on reconnect #209

Closed bmancini55 closed 4 years ago

bmancini55 commented 4 years ago

Exchange Bittrext

Subscription type Any

Describe the bug Looks like a crash on reconnect when it tries to send to the send and the socket no longer exists.

2020-09-02T22:11:08.948Z - info: 7 trades, 1.40 tps
2020-09-02T22:11:13.948Z - info: 4 trades, 0.80 tps
2020-09-02T22:11:18.948Z - info: 0 trades, 0.00 tps
2020-09-02T22:11:23.949Z - info: 0 trades, 0.00 tps
2020-09-02T22:11:28.948Z - info: 0 trades, 0.00 tps
/usr/src/trades/trade-engine/node_modules/ccxws/src/exchanges/bittrex-client.js:85
    this._wss.send(
              ^

TypeError: Cannot read property 'send' of undefined
    at BittrexClient._sendSubTrades (/usr/src/trades/trade-engine/node_modules/ccxws/src/exchanges/bittrex-client.js:85:15)
    at BittrexClient._onConnected (/usr/src/trades/trade-engine/node_modules/ccxws/src/basic-client.js:232:12)
    at SmartWss.emit (events.js:203:15)
    at WebSocket._wss.on (/usr/src/trades/trade-engine/node_modules/ccxws/src/smart-wss.js:73:14)
    at WebSocket.emit (events.js:198:13)
    at WebSocket.setSocket (/usr/src/trades/trade-engine/node_modules/ws/lib/websocket.js:170:10)
    at ClientRequest.req.on (/usr/src/trades/trade-engine/node_modules/ws/lib/websocket.js:643:15)
    at ClientRequest.emit (events.js:198:13)
    at TLSSocket.socketOnData (_http_client.js:484:11)
    at TLSSocket.emit (events.js:198:13)