Skip to content

Commit

Permalink
fix readystate
Browse files Browse the repository at this point in the history
  • Loading branch information
hazae41 committed Feb 28, 2023
1 parent f42e461 commit ccd0439
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mods/websocket/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class WebSocketClient extends EventTarget implements WebSocket {

readonly #key = Bytes.toBase64(Bytes.random(16))

#readyState = WebSocket.CLOSED
#readyState = WebSocket.CONNECTING

binaryType: BinaryType = "blob"

Expand Down Expand Up @@ -200,6 +200,8 @@ export class WebSocketClient extends EventTarget implements WebSocket {
if (headers2.get("Sec-WebSocket-Accept") !== Bytes.toBase64(hash))
throw new Error(`Invalid Sec-WebSocket-Accept header value`)

this.#readyState = this.OPEN

const openEvent = new Event("open")
this.dispatchEvent(openEvent)
}
Expand Down

0 comments on commit ccd0439

Please sign in to comment.