diff --git a/src/server.tsx b/src/server.tsx index f2780e0..ba4fbec 100644 --- a/src/server.tsx +++ b/src/server.tsx @@ -167,7 +167,7 @@ app.get("/", c => c.html()) app.get("/ws", c => { const _sessionId = c.req.query("session") const url = new URL(c.req.url) - let hostname = url.hostname + (url.port === "80" ? "" : `:${url.port}`) + let hostname = url.hostname + (!url.port || url.port === "80" ? "" : `:${url.port}`) return upgradeWebSocket(c, { async onOpen(_e, ws) {