Harden chat WebSocket for mobile lifecycle (background/resume, network switch, reconnect) #23
Notifications
Due Date
No due date set.
Blocks
#20 Ship Android app by wrapping the web build with Capacitor
ai_ml_operations/chat_web_app
#21 Ship iOS app by wrapping the web build with Capacitor
ai_ml_operations/chat_web_app
Reference: ai_ml_operations/chat_web_app#23
Reference in New Issue
Block a user
Risk
Blocks #20 (Android) and #21 (iOS).
Live chat runs over
REACT_APP_BACKEND_WS_API_BASE_URL(wss://chatbackend.aimloperations.com/ws/chat_again/) from the WebSocket context insrc/llm-fe/contexts/. On desktop the tab stays alive, so a fragile connection is rarely noticed. On mobile the OS suspends the WebView on backgrounding and tears down sockets (iOS aggressively, Android on doze/low memory), and the socket also dies when the device switches cellular to WiFi. Without reconnect logic the user returns to a dead chat with no error, and in-flight streamed responses are lost.Work
Appresumeand on@capacitor/networkconnectivity change, not only on socketclose./ws/path.Done when
Backgrounding the app or switching networks returns to a working chat without a manual reload, and connection state is visible to the user.