* Called when futures 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 * @retu
(wsBind, reconnect, code, reason)
| 1749 | * @return {undefined} |
| 1750 | */ |
| 1751 | handleFuturesSocketClose(wsBind, reconnect, code, reason) { |
| 1752 | delete this.futuresSubscriptions[wsBind.url]; |
| 1753 | if (this.futuresSubscriptions && Object.keys(this.futuresSubscriptions).length === 0) { |
| 1754 | clearInterval(this.socketHeartbeatInterval); |
| 1755 | } |
| 1756 | this.Options.log('Futures WebSocket closed: ' + wsBind.url + |
| 1757 | (code ? ' (' + code + ')' : '') + |
| 1758 | (reason ? ' ' + reason : '')); |
| 1759 | if (this.Options.reconnect && wsBind.reconnect && reconnect) { |
| 1760 | if (wsBind.url && wsBind.url.length === 60) this.Options.log('Futures account data WebSocket reconnecting...'); |
| 1761 | else this.Options.log('Futures WebSocket reconnecting: ' + wsBind.url + '...'); |
| 1762 | try { |
| 1763 | reconnect(); |
| 1764 | } catch (error) { |
| 1765 | this.Options.log('Futures WebSocket reconnect error: ' + error.message); |
| 1766 | } |
| 1767 | } |
| 1768 | } |
| 1769 | |
| 1770 | /** |
| 1771 | * Called when a futures websocket errors |