From 37107a735eacc663bc2e61e0ceafb4fd878b47de Mon Sep 17 00:00:00 2001 From: Mqx <62719703+Mqxx@users.noreply.github.com> Date: Mon, 19 Jun 2023 13:09:55 +0200 Subject: [PATCH] Update web_socket_server.ts --- web_socket_server.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web_socket_server.ts b/web_socket_server.ts index 0952608..e72e0d7 100644 --- a/web_socket_server.ts +++ b/web_socket_server.ts @@ -5,9 +5,13 @@ export function WebSocketServer(options : Deno.ServeOptions | Deno.ServeTlsOptio if (request.headers.get("upgrade") != "websocket") { return new Response(null, { status: 501 }); } + + // Needed because of a bug: https://github.com/denoland/deno/issues/19471 + const req = Object.assign({}, request) + const {socket, response} = Deno.upgradeWebSocket(request) - handler(socket, request) + handler(socket, req); return response })