Conversation
Adds a complete Server-Sent Events (SSE) infrastructure for handling real-time updates and activity notifications. Includes: - SSEClient wrapper with automatic reconnection and event parsing - Singleton SSEService managing global state, cross-tab coordination, and cache invalidation - Vue composable useSSE for easy component integration - Session lifecycle integration to start/stop SSE based on auth state - Comprehensive unit tests for the client - Proxy configuration for the /events/stream endpoint
Remove duplicated BroadcastManager/TabCoordinator instances by merging SSEService into CacheSyncService. Extract CacheInvalidator for SRP. Fix proxy rewrite, duplicate listener, and sort bugs.
- only start SSE for client accounts (account.kind === 'client') - wire afterLogin into accountGuard to trigger SSE after session load - close existing EventSource before creating new connection - add 60s inactivity watchdog to detect silent connection deaths - add console.log for cache invalidation debugging
Remove client-side inactivity timeout mechanism from SSE client and implement reconnection logic in cache-sync-service when server closes the connection. This provides more reliable handling of server-initiated disconnects by responding to explicit close events rather than relying on inactivity detection. - Add scheduleReconnect and clearClosedReconnectTimeout methods - Remove inactivityTimeout option and related methods from SSE client - Add tests for ping and closed event handling
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.
Feature
Description
Adds a complete Server-Sent Events (SSE) infrastructure for handling real-time updates and activity notifications.
Components added:
src/services/v2/base/sse/sse-client.js): Wrapper with automatic reconnection and event parsingsrc/services/v2/base/sse/sse-service.js): Singleton managing global state, cross-tab coordination, and cache invalidationsrc/composables/useSSE.js): Vue composable for easy component integrationsrc/services/v2/base/auth/sessionManager.js): Starts/stops SSE based on auth statesrc/tests/services/v2/base/sse/sse-client.test.js): Comprehensive test coverage for the clientvite.config.js): Proxy configuration for/events/streamendpointHow to test
yarn dev/events/streamis establishedyarn test:unit:headless --run src/tests/services/v2/base/sse/sse-client.test.jsTechnical Details