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

Method handleDeliverySocketClose

src/node-binance-api.ts:2482–2499  ·  view source on GitHub ↗

* Called when delivery websocket is closed, subscriptions are de-registered for later reference * @param {boolean} reconnect - true or false to reconnect the socket * @param {string} code - code associated with the socket * @param {string} reason - string with the response * @ret

(wsBind, reconnect, code, reason)

Source from the content-addressed store, hash-verified

2480 * @return {undefined}
2481 */
2482 handleDeliverySocketClose(wsBind, reconnect, code, reason) {
2483 delete this.deliverySubscriptions[wsBind.url];
2484 if (this.deliverySubscriptions && Object.keys(this.deliverySubscriptions).length === 0) {
2485 clearInterval(this.socketHeartbeatInterval);
2486 }
2487 this.Options.log('Delivery WebSocket closed: ' + wsBind.url +
2488 (code ? ' (' + code + ')' : '') +
2489 (reason ? ' ' + reason : ''));
2490 if (this.Options.reconnect && wsBind.reconnect && reconnect) {
2491 if (wsBind.url && wsBind.url.length === 60) this.Options.log('Delivery account data WebSocket reconnecting...');
2492 else this.Options.log('Delivery WebSocket reconnecting: ' + wsBind.url + '...');
2493 try {
2494 reconnect();
2495 } catch (error) {
2496 this.Options.log('Delivery WebSocket reconnect error: ' + error.message);
2497 }
2498 }
2499 }
2500
2501 /**
2502 * 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