Repository navigation
Add the portal WebSocket with heartbeats (W4-03) - #108
Merged
Merged
Conversation
session.revoked is published to the account topic, so revoking one device's session closed every socket on the account. Re-check this socket's session before forwarding the event and closing with 4001.
# Conflicts: # backend/app/main.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The portal updates live. New conversations, new messages, and the end of a shift all arrive over one WebSocket per tab (TDD 4.6.4). The same socket carries the portal's heartbeat every 30 seconds, which is what tells the site a responder is really there (#48). This ticket adds
/ws/portal, which listens on the account's event bus topic (#74) and forwards events to the browser.Changes:
/ws/portalwith cookie authentication, an exact Origin check against the newapp_originsetting, and account-topic JSON event forwarding. Off-shift staff can connect.last_seen_at, so heartbeats and reconnects cannot extend the idle timeout.session.revokedafter committed single/bulk revocations, forward that event, and close the socket with 4001. Heartbeats also detect revocation, expiry, or deactivation without an event.APP_ORIGINin the environment example and extend Uvicorn's WebSocket log filter to cover trace messages containing client addresses.Validation:
make checkpassed: lint/format, backend/frontend type checks, 376 backend tests, 152 frontend tests, and the production frontend build.alembic upgrade headandalembic checkpassed; no schema changes are needed.Closes #91