MCPcopy Create free account
hub / github.com/ccxt/node-binance-api / handleFuturesSocketClose

Function handleFuturesSocketClose

deprecated/node-binance-api.js:861–878  ·  view source on GitHub ↗
(reconnect, code, reason)

Source from the content-addressed store, hash-verified

859 * @return {undefined}
860 */
861 const handleFuturesSocketClose = function (reconnect, code, reason) {
862 delete Binance.futuresSubscriptions[this.endpoint];
863 if (Binance.futuresSubscriptions && Object.keys(Binance.futuresSubscriptions).length === 0) {
864 clearInterval(Binance.socketHeartbeatInterval);
865 }
866 Binance.options.log('Futures WebSocket closed: ' + this.endpoint +
867 (code ? ' (' + code + ')' : '') +
868 (reason ? ' ' + reason : ''));
869 if (Binance.options.reconnect && this.reconnect && reconnect) {
870 if (this.endpoint && parseInt(this.endpoint.length, 10) === 60) Binance.options.log('Futures account data WebSocket reconnecting...');
871 else Binance.options.log('Futures WebSocket reconnecting: ' + this.endpoint + '...');
872 try {
873 reconnect();
874 } catch (error) {
875 Binance.options.log('Futures WebSocket reconnect error: ' + error.message);
876 }
877 }
878 };
879
880 /**
881 * Called when a futures websocket errors

Callers

nothing calls this directly

Calls 2

reconnectFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected