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

Function handleDeliverySocketClose

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

Source from the content-addressed store, hash-verified

1564 * @return {undefined}
1565 */
1566 const handleDeliverySocketClose = function (reconnect, code, reason) {
1567 delete Binance.deliverySubscriptions[this.endpoint];
1568 if (Binance.deliverySubscriptions && Object.keys(Binance.deliverySubscriptions).length === 0) {
1569 clearInterval(Binance.socketHeartbeatInterval);
1570 }
1571 Binance.options.log('Delivery WebSocket closed: ' + this.endpoint +
1572 (code ? ' (' + code + ')' : '') +
1573 (reason ? ' ' + reason : ''));
1574 if (Binance.options.reconnect && this.reconnect && reconnect) {
1575 if (this.endpoint && parseInt(this.endpoint.length, 10) === 60) Binance.options.log('Delivery account data WebSocket reconnecting...');
1576 else Binance.options.log('Delivery WebSocket reconnecting: ' + this.endpoint + '...');
1577 try {
1578 reconnect();
1579 } catch (error) {
1580 Binance.options.log('Delivery WebSocket reconnect error: ' + error.message);
1581 }
1582 }
1583 };
1584
1585 /**
1586 * Called when a delivery websocket errors

Callers

nothing calls this directly

Calls 2

reconnectFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected