From 635aed426ebab10d38dc36c940ca46af0d024d5b Mon Sep 17 00:00:00 2001 From: Milad Raeisi Date: Mon, 16 Sep 2024 12:29:06 +0400 Subject: [PATCH] Update relay.service.ts --- src/app/services/relay.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/services/relay.service.ts b/src/app/services/relay.service.ts index e0a5a78..2a51198 100644 --- a/src/app/services/relay.service.ts +++ b/src/app/services/relay.service.ts @@ -88,7 +88,11 @@ export class RelayService { } public connectToRelays() { - this.relays.forEach((relay) => this.connectToRelay(relay)); + this.relays.forEach((relay) => { + if (!relay.connected) { + this.connectToRelay(relay); + } + }); } public async ensureConnectedRelays(): Promise { @@ -106,6 +110,7 @@ export class RelayService { }); } + private setupVisibilityChangeHandling() { document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible') {