()
| 902 | } |
| 903 | |
| 904 | private scheduleReconnect() { |
| 905 | if ( |
| 906 | !shouldScheduleReconnect({ |
| 907 | terminal: this.terminal, |
| 908 | hasPendingReconnect: this.reconnectTimeout !== null, |
| 909 | hasLiveSocket: this.wsId !== null, |
| 910 | keepAliveRequested: this.keepAliveRequested, |
| 911 | hasLiveSubscriptions: this.hasLiveSubscriptions(), |
| 912 | }) |
| 913 | ) { |
| 914 | return; |
| 915 | } |
| 916 | |
| 917 | const delay = this.reconnectDelayMs; |
| 918 | this.reconnectDelayMs = Math.min( |
| 919 | this.reconnectDelayMs * 2, |
| 920 | RECONNECT_MAX_DELAY_MS, |
| 921 | ); |
| 922 | |
| 923 | this.reconnectTimeout = window.setTimeout(() => { |
| 924 | this.reconnectTimeout = null; |
| 925 | void this.ensureConnected().catch(() => { |
| 926 | this.scheduleReconnect(); |
| 927 | }); |
| 928 | }, delay); |
| 929 | } |
| 930 | |
| 931 | private emitReconnectIfNeeded() { |
| 932 | const shouldNotifyReconnectListeners = |
no test coverage detected