Skip to content

Commit 761fce9

Browse files
KhafraDevmcollina
andauthored
fix websocketstream open error (#4748)
* fix websocketstream open error Co-authored-by: Matteo Collina <hello@matteocollina.com> * fix more tests --------- Co-authored-by: Matteo Collina <hello@matteocollina.com>
1 parent 9ec9160 commit 761fce9

File tree

2 files changed

+187
-264
lines changed

2 files changed

+187
-264
lines changed

‎lib/web/websocket/stream/websocketstream.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ class WebSocketStream {
370370
this.#openedPromise.reject(new WebSocketError('Socket never opened'))
371371
}
372372

373-
const result = this.#parser.closingInfo
373+
const result = this.#parser?.closingInfo
374374

375375
// 4. Let code be the WebSocket connection close code .
376376
// https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5
@@ -411,10 +411,10 @@ class WebSocketStream {
411411
const error = createUnvalidatedWebSocketError('unclean close', code, reason)
412412

413413
// 7.2. Error stream ’s readable stream with error .
414-
this.#readableStreamController.error(error)
414+
this.#readableStreamController?.error(error)
415415

416416
// 7.3. Error stream ’s writable stream with error .
417-
this.#writableStream.abort(error)
417+
this.#writableStream?.abort(error)
418418

419419
// 7.4. Reject stream ’s closed promise with error .
420420
this.#closedPromise.reject(error)

0 commit comments

Comments
 (0)