Service Worker
This document describes how the service worker enhances the application’s behavior, including its supported features like session management, client communication, and request tracking, as well as the potential impact if it fails or becomes unavailable.
Categories:
Supported Features
Session Management
- Auto Logout: Monitors active browser tabs and automatically logs out the user from the backend session when no clients are active.
- Session Check: Periodically pings the backend to verify the session status. If the session is invalid or expired, the service worker informs all open tabs.
- Session Update Notifications: Broadcasts session-related updates (login, logout, expiration) to all clients, ensuring users receive timely notifications.
Client Communication and Coordination
- Multi-Tab Synchronization: Listens for events such as “NewTab” and “TabClosed” to update the list of active clients and coordinate actions across them.
- Language & Project Updates: Relays language changes and locked project updates among all active tabs, ensuring a unified experience.
- PostMessage Communication: Uses a dedicated messaging system to send updates and notifications to clients, keeping the application state in sync.
Impact When the Service Worker Is Not Working
If the service worker fails or is unavailable, the following issues may arise:
- Compromised Session Management: Without the service worker, automatic logout and periodic session validation may not occur. This could lead to stale sessions or unexpected logouts.
- Delayed or Missing Notifications: Real-time notifications regarding session updates, language changes, or locked projects may not be delivered, causing inconsistencies across tabs.
- Inter-Tab Coordination Breakdowns: Multi-tab synchronization will be impaired, potentially leading to conflicting application states and user confusion.
Troubleshooting
If you notice issues that may be related to the service worker, consider the following steps:
- Verify Browser Support: Ensure that your browser supports service workers.
- Check Service Worker Registration: Use the browser’s developer tools to confirm that the service worker is registered and active.
- Clear Cache: Unregister old service workers and clear the browser cache to resolve potential conflicts.
- Look for Fallback Notifications: The application may display a warning if the service worker is unavailable.