mirror of
https://github.com/wu736139669/hapi.git
synced 2026-10-10 19:42:21 +00:00
fix(web): recover silently-dead SSE connections quickly, stop banner noise (#1562)
A suspended mobile tab can lose its SSE connection without the browser ever noticing (no FIN/RST arrives). On resume the client used to wait for the 90s heartbeat watchdog or lean on the native EventSource retry, which can hang on a dead pooled socket - leaving a persistent "Reconnecting... (stream error)" banner while the UI keeps working. - useSSE: on visibility resume, distrust the connection after one missed heartbeat interval (45s) instead of 90s - useSSE: abandon connection attempts that don't open within 10s (hung on a dead pooled socket after resume) instead of waiting for the watchdog; force bypasses the one-shot reconnect guard for the new attempt cycle - useSSE: first reconnect attempt is immediate; exponential backoff starts from the second attempt - ReconnectingBanner: localize connect-timeout and transport-error reasons (transport-error is already emitted by current code but fell through unlabeled) Fixes #1559. Reimplements the reconnect half of #989 (closed unmerged) on top of the current scheduler (hidden-tab deferral, slow backoff, replay cursor).
This commit is contained in:
@@ -7,6 +7,12 @@ function getReasonLabel(reason: string, t: (key: string) => string): string {
|
||||
if (reason === 'visibility-recovery') {
|
||||
return t('reconnecting.reason.visibilityRecovery')
|
||||
}
|
||||
if (reason === 'connect-timeout') {
|
||||
return t('reconnecting.reason.connectTimeout')
|
||||
}
|
||||
if (reason === 'transport-error') {
|
||||
return t('reconnecting.reason.transportError')
|
||||
}
|
||||
if (reason === 'closed') {
|
||||
return t('reconnecting.reason.closed')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user