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 })