Skip to content

Commit

Permalink
Update web_socket_server.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqxx authored Jun 19, 2023
1 parent aba24ce commit 37107a7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web_socket_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down

0 comments on commit 37107a7

Please # to comment.