Fall back to REST polling when the WebSocket cannot connect
CI/CD / backend (pull_request) Successful in 6m6s
CI/CD / frontend (pull_request) Successful in 5m15s
CI/CD / build (pull_request) Skipped
CI/CD / deploy (pull_request) Skipped
CI/CD / cleanup (pull_request) Skipped

On some mobile networks/browsers the wss:// upgrade is blocked even though the
page loads (the server side is verified working: a browser-style handshake gets
101). After three socket failures the header now shows "polling (5s)" instead
of a misleading perpetual "reconnecting", since the 5s REST poll keeps all data
correct. The socket error handler also surfaces the browser's message.
This commit is contained in:
matitos committed 2026-09-20 12:48:10 +00:00
1 parent 07c17fbd2c
commit bf7eda3f6a
2 files changed
+16 -4

No files matched your search

+6 -1
View File
@@ -58,7 +58,12 @@ export function openSocket({ onMessage, onOpen, onClose, onError }) {
onError?.(event.code, event.reason)
schedule()
}
socket.onerror = () => socket.close()
socket.onerror = (event) => {
// The browser hides details here; surface what it does give us.
const detail = event?.message || 'connection error'
onError?.(0, detail)
socket.close()
}
}
connect()