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

Function handleSocketClose

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

Source from the content-addressed store, hash-verified

664 * @return {undefined}
665 */
666 const handleSocketClose = function (reconnect, code, reason) {
667 delete Binance.subscriptions[this.endpoint];
668 if (Binance.subscriptions && Object.keys(Binance.subscriptions).length === 0) {
669 clearInterval(Binance.socketHeartbeatInterval);
670 }
671 Binance.options.log('WebSocket closed: ' + this.endpoint +
672 (code ? ' (' + code + ')' : '') +
673 (reason ? ' ' + reason : ''));
674 if (Binance.options.reconnect && this.reconnect && reconnect) {
675 if (this.endpoint && parseInt(this.endpoint.length, 10) === 60) Binance.options.log('Account data WebSocket reconnecting...');
676 else Binance.options.log('WebSocket reconnecting: ' + this.endpoint + '...');
677 try {
678 reconnect();
679 } catch (error) {
680 Binance.options.log('WebSocket reconnect error: ' + error.message);
681 }
682 }
683 };
684
685 /**
686 * Called when socket errors

Callers

nothing calls this directly

Calls 2

reconnectFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected