realtime: emit and handle chat_deleted for full chat removals
All checks were successful
CI / test (push) Successful in 38s

This commit is contained in:
2026-03-08 19:41:49 +03:00
parent a896568c53
commit 744ded914d
7 changed files with 73 additions and 4 deletions

View File

@@ -211,7 +211,21 @@ Sent when chat metadata/membership/roles/title changes:
}
```
## 3.8 `error`
## 3.8 `chat_deleted`
Sent when a chat is removed for all members/subscribers:
```json
{
"event": "chat_deleted",
"payload": {
"chat_id": 10
},
"timestamp": "2026-03-08T12:00:00Z"
}
```
## 3.9 `error`
Validation/runtime error during WS processing:
@@ -236,6 +250,7 @@ Validation/runtime error during WS processing:
- Send periodic `ping` and expect `pong`.
- Reconnect with exponential backoff.
- On `chat_updated`, refresh chat metadata via REST (`GET /api/v1/chats` or `GET /api/v1/chats/{chat_id}`).
- On `chat_deleted`, remove the chat from local state immediately and clear active-chat selection if needed.
- On reconnect/visibility restore, reconcile state by reloading already-opened chats/messages via REST
to recover missed `message_deleted`/delivery updates after transient disconnects or backend restarts.
- For browser notifications, mentions (`@username`) should be treated as high-priority and can bypass