(code: number, reason: string)
| 240 | } |
| 241 | |
| 242 | private _onClose(code: number, reason: string): void { |
| 243 | this._closed = true; |
| 244 | this._closeReason = { code, reason }; |
| 245 | recordReportEvent( |
| 246 | { |
| 247 | kind: 'ws', |
| 248 | direction: 'lifecycle', |
| 249 | url: this.opts.url, |
| 250 | message: 'close', |
| 251 | frame: { code, reason }, |
| 252 | }, |
| 253 | { reportDir: this.opts.reportDir }, |
| 254 | ); |
| 255 | for (const w of this._waiters.splice(0)) { |
| 256 | w.reject(new Error(`ws closed (code=${code}) before matching frame arrived`)); |
| 257 | } |
| 258 | for (const w of this._closeWaiters.splice(0)) w(this._closeReason); |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | function pingNonce(frame: AnyFrame): string { |
no test coverage detected