jaggedsoft / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.
MIT License
1.58k stars 768 forks source link

WebSocket disconnect cause a crash #237

Closed tymmesyde closed 6 years ago

tymmesyde commented 6 years ago

Short Description:

Platform:

node version:

Full error log

[ 'WebSocket error: UAbF4GKdphd2wKL9k3YRnUehuBu65TO1dyPOHWm61yjqwSvaCZSWMtN5AKSH (ECONNRESET) read ECONNRESET' ]
[ 'WebSocket closed: UAbF4GKdphd2wKL9k3YRnUehuBu65TO1dyPOHWm61yjqwSvaCZSWMtN5AKSH (1006)' ]
[ 'Account data WebSocket reconnecting...' ]
[ 'WebSocket error: 3765091000 (ECONNRESET) read ECONNRESET' ]
[ 'WebSocket closed: 3765091000 (1006)' ]
[ 'WebSocket reconnecting: 3765091000...' ]
[ 'WebSocket error: 3765091000 (ENOTFOUND) getaddrinfo ENOTFOUND stream.binance.com stream.binance.com:9443' ]
[ 'WebSocket closed: 3765091000 (1006)' ]
[ 'WebSocket reconnecting: 3765091000...' ]
[ 'WebSocket error: 3765091000 (ENOTFOUND) getaddrinfo ENOTFOUND stream.binance.com stream.binance.com:9443' ]
[ 'WebSocket closed: 3765091000 (1006)' ]
[ 'WebSocket reconnecting: 3765091000...' ]
[ 'WebSocket error: undefined (ENOTFOUND) getaddrinfo ENOTFOUND stream.binance.com stream.binance.com:9443' ]
[ 'WebSocket closed: undefined (1006)' ]
C:\Users\tymme\Documents\Bitbucket\bibot\node_modules\node-binance-api\node-binance-api.js:322
            if ( parseInt(this.endpoint.length, 10) === 60 ) options.log('Account data WebSocket reconnecting...');
                                        ^

TypeError: Cannot read property 'length' of undefined
    at WebSocket.handleSocketClose (C:\Users\tymme\Documents\Bitbucket\bibot\node_modules\node-binance-api\node-binance-api.js:322:41)

It's not really a big deal, but I'd rather warn you if not already done. Bye the way great lib ! Love it :)

jaggedsoft commented 6 years ago

Thank you! This is very helpful. We should also catch the ENOTFOUND error and handle that separately