Fix desktop messages not appearing live until refocus (#59)

Desktop mode's focus gating (from #49) made losing OS focus send "leave"
for every open room, which stopped live message delivery to that room,
not just notification eligibility -- so a message wouldn't render until
the room was manually left and rejoined. Room join/leave is now gated on
visibility alone, matching the browser; notification eligibility gets its
own separate signal (a "focus"/"blur" WS frame tracked by a new
Redis-backed FocusPresence), so a connected-but-unfocused desktop member
still gets notified without losing live delivery.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-19 18:08:04 -06:00
co-authored by Claude Sonnet 5
parent 1d9fe25410
commit ed88eb0205
7 changed files with 250 additions and 49 deletions
+2 -1
View File
@@ -25,4 +25,5 @@ async def incoming_webhook_endpoint(
broadcaster = request.app.state.broadcaster
presence = request.app.state.presence
await broadcast_new_message(db, broadcaster, presence, room.id, message, sender)
focus_presence = request.app.state.focus_presence
await broadcast_new_message(db, broadcaster, presence, focus_presence, room.id, message, sender)