Replace the whole member state only when its version is at least the held version. Suppress deleted identities before merging revisions; keep position coverage when bodies go. Merge every message carrier by id and highest revision; a missing revision fetches that message again; render and gap-check by seq, never by version. Full rows apply their peer card with their state; unknown conversations fetch a full row. A refetched first page replaces its view: a held row missing from it leaves, unless something was applied for it after the request started. A row that left comes back only from a later list that includes it, a get sent after it left, or a higher version; a same-version state still applies but doesn't bring it back. A state-bearing reply missing its version, or any other required field, keeps held state, merges nothing and fetches a complete copy. Edits carry the message and the member's complete state: the state applies by version and the message merges by revision; a marker for the held preview also fetches the conversation. Every complete state first raises the retained deletedThroughSeq. Remove covered messages, quotes and edit/reply targets before merging revisions, even equal revisions. Keep that cut-off when bodies are evicted. Gap-check only (deletedThroughSeq, visible horizon], with the horizon requestFirstSeq for a pending receiver and lastSeq otherwise. Pause to hold events, or drop them to simulate lost events. Refresh state on inbox open, thread open, foreground and reconnect, including cached chats beyond page one. This corrects the preview, unread count, inbox time and mute state (how a missed mute event recovers), and removes messages and quotes covered by a conversation cut-off. Opening a cached thread catches up by seq, then re-reads its newest page; foreground and reconnect only catch up. A missed edit or single-message deletion stays in a held message until that message's page is read again. The required fields include the block ones (blockedByMe, userBlockVersion, visibilityVersion, peerHiddenThroughSeq, available, listed, requestFirstSeq); a conversation that gets no complete copy shows as temporarily unavailable. Learn the highest peerHiddenThroughSeq (W: the other person's messages at or below it stay hidden, with quotes of them) and a newer visibilityVersion before content too; a newer visibility drops held bodies and page coverage but keeps deletions, and content from an older one restores nothing. A history page's scanned range covers the positions it skipped: they are never gaps to fetch again. A refused history cursor (1401) refreshes state and restarts paging once. Message, edit and Accept events from a person you blocked are dropped. user.block.changed carries your own Block or Unblock from any of your devices.
The missing-message control sends sample text in the open thread. A 1411 refusal offers to send it without a quote under a new key. A send retry repeats its submitted body and reply target; after an edit, its body is not compared. Retry last edit repeats its submitted text and revision; a new Save uses the editor text. A 1416 keeps the text unsent, refreshes the conversation and measures the server clock again; retry manually after the limit resets.
Fetch a list or the open conversation and hold its response without applying it. Read on another tab (AE5), or Accept here (AE10), then apply the held response: an older version must leave the state and peer card unchanged. A held person lookup for the open chat or person, applied after Block (whose reply starts a newer lookup), must be dropped.
Block and Unblock are POST /auth/user/:userId/block and /unblock, each attempt with a new idempotency key, reused only to learn an unknown outcome. A reply on a chat screen applies current by its version, then looks the person up again and refreshes the dots without waiting for user.block.changed. The two buttons below stand for a screen outside chat: they apply current only, so a lost follow-up shows at the next refresh. A simulated answer replaces the next Block or Unblock (a Delete and block job's included) or the next conversation delete once, then resets to real. Delete and block jobs live in this browser's local storage per account: a second tab of the same account shares them, so use another browser or a private window as the other device.
Any method and payload over the connection, e.g. accept your own request (1403), send as the receiver of a pending request (1409), an unknown method or a bad payload (1401).
Serve this file over http (for example npx http-server test -p 8765) rather than opening it from disk, and open one tab per user (the login is kept per tab).
Gateway calls blocked by the browser: with NODE_ENV=development every origin is allowed; under any other NODE_ENV the page's origin must be listed in ALLOWED_ORIGINS in the gateway's process environment.
Connection fails with only "transport closed" and no close code: the chat server refuses browser connections whose origin it does not know. Set CHAT_CENTRIFUGO_ALLOWED_ORIGINS to this page's origin (scheme://host[:port], no path, no trailing slash, never *; space-separated for several), e.g. CHAT_CENTRIFUGO_ALLOWED_ORIGINS=http://localhost:8765, in .env for docker-compose.yml or .env.test for the test stack, then recreate the chat server container(s). Do not set CENTRIFUGO_CLIENT_ALLOWED_ORIGINS directly: the compose files set it from the CHAT_ key, empty when that is unset. The login itself needs nothing extra: the token travels inside the connect command and the server forwards it as the Authorization header.
Reads send only from a visible thread on a focused page, with one command in flight per conversation and the highest displayed seq queued. Pending reads retry after reconnect; a capped reply never causes a resend. The Requests dot follows the summary alone: no row or event lights it. The chat dot turns on from applied unread state and clears only from the summary. The summary is refreshed on open, foreground, reconnect, any applied state of a conversation the other member started and, while the chat dot is on or a call is in flight, any applied state that misses its condition: accepted, not archived, not muted, unread above 0. A list or single-conversation response that shows an unread chat also asks. One summary call runs at a time; a trigger during a call asks once more after it, with at most one start a second. Each summary call has an independent 15-second client deadline, above the usual two-RPC 503 window (AuthGuard and summary default to 5 seconds each); a slow throttler Redis increment can push the gateway past that deadline, so a timeout counts as a failed call, keeps the dots, and lets any queued refresh run under the normal one-start-per-second cap. While the Requests list is on screen, visible and focused, once its first page has shown (every entry reloads it; a failed load reads the summary instead and marks nothing), that refresh is PATCH /chat/requests/seen, never retried, even after a timeout (a plain 404, a server without the route, switches this account to ordinary summary reads): every request received so far, loaded or not, stops lighting the Requests dot for the account, each keeps its own unread dot, and a request that arrives later lights it again. Leaving the list sends nothing, so a call sent as the user leaves can never land late. The opening call goes out at once, even beside another call, whose answer is then dropped, and one more refresh follows both. Another device follows at its next refresh. The Messages icon lights on either dot, so a request seen on the Requests screen but not opened no longer lights it. Ignore moves a request from Requests to Archived (the link on the Requests screen, always shown) and out of the dot on every device, and the conversation still opens from the person. Rows are placed from held state: Archived only while a request the other member sent is pending and archived. Archived rows show no unread badge, refetch on open, foreground and reconnect (not on an Inbox tap or a thread's back), show a failed load on the Archived screen with Retry, and open with Block and Accept (no Ignore). Mute and Unmute (accepted rows only; a pending one answers 1417) set the value on every one of your devices: a muted row shows 🔕, keeps its unread count and raises no toast, under the banner rule proposed to the mobile team.
Block: offered on a request you received (Requests and Archived), in your own pending request's menu (with Report, not built yet, and Delete conversation; no Mute) and in an accepted chat's menu, each only once a complete person lookup has succeeded, behind a confirmation whose Cancel sends nothing. An accepted chat's Delete on its row also offers Delete and block, unless you blocked that person already. A chat or request you blocked keeps its place and history and shows Unblock with no message box; a request you received has no Delete. Someone who blocked you shows as "Profile unavailable": you can keep writing in a chat you still have, and once you have none, the person view says "Messages are disabled because this profile is unavailable." A request withdrawn by its requester's Block answers "This request is no longer available"; write to the person instead. After a Block or Unblock reply the page looks the person up again and refreshes the summary; open, foreground and reconnect refresh held chats (an unavailable one through its person), the open person and the summary.