Skip to content

Commit

Permalink
Revert "fix: fire close on failed WebSocket connection (#3566)"
Browse files Browse the repository at this point in the history
This reverts commit 290e0e1.
  • Loading branch information
KhafraDev authored Sep 20, 2024
1 parent 290e0e1 commit 143fbfe
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
8 changes: 0 additions & 8 deletions lib/web/websocket/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,14 +537,6 @@ class WebSocket extends EventTarget {
message: reason
})
}

if (!this.#parser && !this.#handler.receivedClose) {
fireEvent('close', this, (type, init) => new CloseEvent(type, init), {
wasClean: false,
code: 1006,
reason
})
}
}

#onMessage (type, data) {
Expand Down
2 changes: 1 addition & 1 deletion test/websocket/issue-3546.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { WebSocket } = require('../..')
const { tspl } = require('@matteo.collina/tspl')

test('first error than close event is fired on failed connection', async (t) => {
const { completed, strictEqual } = tspl(t, { plan: 4 })
const { completed, strictEqual } = tspl(t, { plan: 2 })
const ws = new WebSocket('ws://localhost:1')

let orderOfEvents = 0
Expand Down

0 comments on commit 143fbfe

Please sign in to comment.