diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index dfdc0c3..5fb0d1d 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -186,7 +186,7 @@ restored on start. Players reconnect by themselves within a few seconds. | `EACCES` during `npm ci`, build, or at start-up | Folder not owned by your user. Re-run the `chown` in step 2. | | `EADDRINUSE` in `pm2 logs` | Port 3010 is taken. Change `PORT` in `ecosystem.config.cjs` and `localPort` in frpc, then `pm2 restart two-keys --update-env` and restart frpc. | | Local `curl` works, domain gives frp's "page not found" | `customDomains` doesn't match the host name exactly, frpc wasn't restarted, or the front proxy rewrites `Host`. | -| Site loads but "Can't reach the server" toasts, or games feel laggy | Websocket upgrade headers missing on the central server's HTTPS proxy. | +| Site loads but games feel laggy, or `/socket.io` requests with `transport=websocket` fail in the browser's network tab | Websocket upgrade headers missing on the central server's HTTPS proxy. The game still works over polling. | | Site loads but no games listed | `npm run build` or `validate-content` failed. Check `pm2 logs two-keys`. | Do not run more than one instance (no pm2 cluster mode, no second copy behind a load balancer): diff --git a/client/package.json b/client/package.json index f5c9206..c58469e 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "@two-keys/client", - "version": "1.0.0", + "version": "1.0.1", "private": true, "type": "module", "scripts": { diff --git a/client/src/lib/socket.ts b/client/src/lib/socket.ts index 8a07579..f145be0 100644 --- a/client/src/lib/socket.ts +++ b/client/src/lib/socket.ts @@ -2,7 +2,9 @@ import { io } from 'socket.io-client'; import type { JoinAck } from '@two-keys/shared'; import { pushToast } from './toasts'; -export const socket = io({ transports: ['websocket', 'polling'] }); +// Polling first, then upgrade: a websocket-first client never falls back, so a proxy that +// drops the Upgrade header would leave it unable to connect at all. +export const socket = io(); socket.on('toast', ({ message }: { message: string }) => pushToast(message)); socket.on('error', ({ message }: { message: string }) => pushToast(message, 'error')); diff --git a/package-lock.json b/package-lock.json index 52c4efe..2e045da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "two-keys", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "two-keys", - "version": "1.0.0", + "version": "1.0.1", "workspaces": [ "shared", "server", @@ -23,7 +23,7 @@ }, "client": { "name": "@two-keys/client", - "version": "1.0.0", + "version": "1.0.1", "dependencies": { "@two-keys/shared": "*", "framer-motion": "^11.11.0", @@ -6847,7 +6847,7 @@ }, "server": { "name": "@two-keys/server", - "version": "1.0.0", + "version": "1.0.1", "dependencies": { "@two-keys/shared": "*", "express": "^4.21.0", @@ -7332,7 +7332,7 @@ }, "shared": { "name": "@two-keys/shared", - "version": "1.0.0", + "version": "1.0.1", "devDependencies": { "vitest": "^2.1.0" } diff --git a/package.json b/package.json index 569836e..2f4ac3b 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,16 @@ { "name": "two-keys", "private": true, - "version": "1.0.0", + "version": "1.0.1", "description": "Co-op mystery games for couples", - "workspaces": ["shared", "server", "client"], - "engines": { "node": ">=20" }, + "workspaces": [ + "shared", + "server", + "client" + ], + "engines": { + "node": ">=20" + }, "scripts": { "dev": "npm run validate-content && concurrently -n server,client \"npm -w server run dev\" \"npm -w client run dev\"", "build": "npm -w shared run build && npm -w client run build && npm -w server run build", diff --git a/server/package.json b/server/package.json index 9b81b1f..6d13bcb 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "@two-keys/server", - "version": "1.0.0", + "version": "1.0.1", "private": true, "type": "module", "scripts": { diff --git a/shared/package.json b/shared/package.json index 336e334..2aea310 100644 --- a/shared/package.json +++ b/shared/package.json @@ -1,11 +1,13 @@ { "name": "@two-keys/shared", - "version": "1.0.0", + "version": "1.0.1", "private": true, "type": "module", "main": "./src/index.ts", "types": "./src/index.ts", - "exports": { ".": "./src/index.ts" }, + "exports": { + ".": "./src/index.ts" + }, "scripts": { "build": "tsc --noEmit -p tsconfig.json", "test": "vitest run"