Implement session replacement and WebSocket keepalive features
Enhanced the session management by allowing a reconnect with the same username to replace the existing session, sending a logout message to the previous session. Introduced WebSocket keepalive functionality using Ping/Pong messages to detect stale connections. Updated documentation to reflect these changes and improve user experience during reconnections.
This commit is contained in:
@@ -47,6 +47,12 @@ Sie ist absichtlich auf das Protokoll und die Client-Integration fokussiert (ohn
|
||||
{"type":5,"message":"room_entered","to":"lobby"}
|
||||
```
|
||||
|
||||
- Erzwungenes Logout bei Session-Ersatz (Reconnect mit gleichem Namen):
|
||||
|
||||
```json
|
||||
{"type":5,"message":"logout","reason":"replaced_by_new_login"}
|
||||
```
|
||||
|
||||
- Chatnachricht:
|
||||
|
||||
```json
|
||||
@@ -183,7 +189,6 @@ function sendMessage(text) {
|
||||
|
||||
- `missing_name`: `init` ohne `name`
|
||||
- `invalid_username`: Username entspricht nicht den Regeln
|
||||
- `loggedin`: Username ist bereits aktiv
|
||||
- `user_not_allowed`: User nicht erlaubt (DB/Allowlist)
|
||||
- `not_initialized`: Command vor `init`
|
||||
- `missing_token`: Token fehlt
|
||||
@@ -194,7 +199,7 @@ function sendMessage(text) {
|
||||
## Hinweise für Frontend-Implementierung
|
||||
|
||||
- Token zentral im Chat-State halten
|
||||
- Reconnect-Strategie einbauen (neues `init`, neues Token)
|
||||
- Reconnect-Strategie einbauen (neues `init`, neues Token); alte Session wird dabei serverseitig ersetzt
|
||||
- Vor Senden auth-pflichtiger Commands Token prüfen
|
||||
- UI sollte Fehler vom Typ `error` immer sichtbar machen
|
||||
- Für Slash-Kommandos reicht normales `message`-Senden
|
||||
|
||||
Reference in New Issue
Block a user