Init multiplayer
All checks were successful
Deploy Feature / deploy-feature (push) Successful in 28s
All checks were successful
Deploy Feature / deploy-feature (push) Successful in 28s
This commit is contained in:
33
server/README.md
Normal file
33
server/README.md
Normal 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.
|
||||
Reference in New Issue
Block a user