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

Method futuresSocketHeartbeat

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

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

()

Source from the content-addressed store, hash-verified

1713 * @return {undefined}
1714 */
1715 futuresSocketHeartbeat() {
1716 /* Sockets removed from subscriptions during a manual terminate()
1717 will no longer be at risk of having functions called on them */
1718 for (const endpointId in this.futuresSubscriptions) {
1719 const ws = this.futuresSubscriptions[endpointId];
1720 if (ws.isAlive) {
1721 ws.isAlive = false;
1722 if (ws.readyState === WebSocket.OPEN) ws.ping(this.noop);
1723 } else {
1724 if (this.Options.verbose) this.Options.log(`Terminating zombie futures WebSocket: ${ws.endpoint}`);
1725 if (ws.readyState === WebSocket.OPEN) ws.terminate();
1726 }
1727 }
1728 }
1729
1730 /**
1731 * Called when a futures 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