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

Method deliverySocketHeartbeat

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

* Delivery heartbeat code with a shared single interval tick * @return {undefined}

()

Source from the content-addressed store, hash-verified

2444 * @return {undefined}
2445 */
2446 deliverySocketHeartbeat() {
2447 /* Sockets removed from subscriptions during a manual terminate()
2448 will no longer be at risk of having functions called on them */
2449 for (const endpointId in this.deliverySubscriptions) {
2450 const ws = this.deliverySubscriptions[endpointId];
2451 if (ws.isAlive) {
2452 ws.isAlive = false;
2453 if (ws.readyState === WebSocket.OPEN) ws.ping(this.noop);
2454 } else {
2455 if (this.Options.verbose) this.Options.log(`Terminating zombie delivery WebSocket: ${ws.endpoint}`);
2456 if (ws.readyState === WebSocket.OPEN) ws.terminate();
2457 }
2458 }
2459 }
2460
2461 /**
2462 * Called when a delivery socket is opened, subscriptions are registered for later reference

Callers

nothing calls this directly

Calls 3

pingMethod · 0.80
logMethod · 0.80
terminateMethod · 0.65

Tested by

no test coverage detected