Init multiplayer
All checks were successful
Deploy Feature / deploy-feature (push) Successful in 28s

This commit is contained in:
Johnny322
2026-02-24 20:54:14 +01:00
parent 6dde7eedb6
commit 9945f8163e
14 changed files with 2027 additions and 53 deletions

33
server/README.md Normal file
View File

@@ -0,0 +1,33 @@
# Realtime Sessions
This app now supports shared sessions by `gameId` using a lightweight WebSocket server.
## Run
```bash
npm run realtime:server
```
Default port: `8787`
Override: `REALTIME_PORT=9000 npm run realtime:server`
## Nginx Proxy
Proxy `/realtime/*` from your public domain to the realtime server:
```nginx
location /realtime/ {
proxy_pass http://127.0.0.1:8787/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
```
Notes:
- `proxy_pass` with trailing `/` is important, because frontend calls `/realtime/sessions` and `/realtime/ws`.
- Sessions are kept in memory; restarting the realtime server resets all active game sessions.