Backend: - Atomic seq assignment via Redis Lua script: INCR + GET run atomically inside a Lua script, preventing duplicate seqs under concurrent requests. DB reconciliation only triggers on cross-server handoff (rare path). - Broadcast channel capacity: 10,000 → 100,000 to prevent message drops under high-throughput rooms. Frontend: - Optimistic sendMessage: adds message to UI immediately (marked isOptimistic=true) so user sees it instantly. Replaces with server-confirmed message on success, marks as isOptimisticError on failure. Fire-and-forget to IndexedDB for persistence. - Seq-based dedup in onRoomMessage: replaces optimistic message by matching seq, preventing duplicates when WS arrives before REST confirm. - Reconnect jitter: replaced deterministic backoff with full jitter (random within backoff window), preventing thundering herd on server restart. - Visual WS status dot in room header: green=connected, amber (pulsing)=connecting, red=error/disconnected. - isPending check extended to cover both old 'temp-' prefix and new isOptimistic flag, showing 'Sending...' / 'Failed' badges. |
||
|---|---|---|
| .. | ||
| ai.rs | ||
| category.rs | ||
| draft_and_history.rs | ||
| member.rs | ||
| message.rs | ||
| mod.rs | ||
| notification.rs | ||
| pin.rs | ||
| reaction.rs | ||
| room.rs | ||
| thread.rs | ||
| ws_handler.rs | ||
| ws_types.rs | ||
| ws_universal.rs | ||
| ws.rs | ||