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.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user