Harden chat WebSocket for mobile lifecycle (#23) #25

Merged
westfarn merged 1 commits from harden-websocket-mobile-lifecycle-23 into master 2026-07-26 13:35:39 -07:00
Owner

Summary

  • Closes Harden chat WebSocket for mobile lifecycle (background/resume, network switch, reconnect) (#23)
  • Add WebSocket reconnect with exponential backoff + jitter (capped attempts), heartbeat keepalives, and reconnect on browser visibility/online plus Capacitor App/Network plugins when present
  • Refresh JWT before reconnect (coordinates with #22) so conversation refetch after a drop still works
  • Mid-stream drop recovery: mark interrupted + refetch conversation; surface connecting/reconnecting/disconnected state and disable send while down

Test plan

  • Unit tests: websocketReconnect helpers + WebSocketProvider reconnect/resume/send (npm run test:ci)
  • Background app ~30s and ~10min, then resume — chat reconnects without reload
  • Airplane mode on/off and cellular↔WiFi — reconnect indicator then restored send
  • Drop mid-stream response — interrupted banner + conversation refetch
  • Confirm nginx//ws/ proxy idle timeout stays above heartbeat (25s) or allows ping payloads
## Summary - Closes #23 - Add WebSocket reconnect with exponential backoff + jitter (capped attempts), heartbeat keepalives, and reconnect on browser visibility/`online` plus Capacitor `App`/`Network` plugins when present - Refresh JWT before reconnect (coordinates with #22) so conversation refetch after a drop still works - Mid-stream drop recovery: mark interrupted + refetch conversation; surface connecting/reconnecting/disconnected state and disable send while down ## Test plan - [x] Unit tests: `websocketReconnect` helpers + `WebSocketProvider` reconnect/resume/send (`npm run test:ci`) - [ ] Background app ~30s and ~10min, then resume — chat reconnects without reload - [ ] Airplane mode on/off and cellular↔WiFi — reconnect indicator then restored send - [ ] Drop mid-stream response — interrupted banner + conversation refetch - [ ] Confirm nginx/`/ws/` proxy idle timeout stays above heartbeat (25s) or allows ping payloads
westfarn added 1 commit 2026-07-26 05:02:04 -07:00
Harden chat WebSocket for mobile lifecycle (#23)
Unit Tests / test (pull_request) Successful in 10s
22f7ea6aaa
Reconnect with backoff/jitter, lifecycle + network resume hooks, JWT refresh before reconnect, heartbeat, and visible connection/stream-interrupted UI so backgrounding or network switches recover without a reload.
westfarn merged commit 7f16a3dca8 into master 2026-07-26 13:35:39 -07:00
westfarn deleted branch harden-websocket-mobile-lifecycle-23 2026-07-26 13:35:39 -07:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/chat_web_app#25