From e8935276a0e053dffd8ff416d00024eaaf1aa2c9 Mon Sep 17 00:00:00 2001 From: gnezim Date: Wed, 15 Apr 2026 20:58:01 +0300 Subject: [PATCH] Fix SignalR connection error handling for offline hub Wrap connection.start() in try/catch so that when the SignalR hub is unreachable the status transitions to "offline" silently instead of throwing unhandled errors that flood the browser console. --- src/shared/signalr/connection.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/shared/signalr/connection.ts b/src/shared/signalr/connection.ts index 4a41737b..0255b11e 100644 --- a/src/shared/signalr/connection.ts +++ b/src/shared/signalr/connection.ts @@ -141,8 +141,13 @@ export class SignalRConnection { this.setStatus("live"); }); - await this.connection.start(); - this.setStatus("live"); + try { + await this.connection.start(); + this.setStatus("live"); + } catch { + // Hub unreachable — go offline silently, don't retry-spam + this.setStatus("offline"); + } } private setStatus(s: ConnectionStatus): void {