From ac0c489da28276ef3db798bae68bfd2d4defaed5 Mon Sep 17 00:00:00 2001 From: koalasat Date: Tue, 20 May 2025 14:06:24 +0200 Subject: [PATCH] Check protocol --- frontend/src/models/Coordinator.model.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/models/Coordinator.model.ts b/frontend/src/models/Coordinator.model.ts index f863523b..0b44ba68 100644 --- a/frontend/src/models/Coordinator.model.ts +++ b/frontend/src/models/Coordinator.model.ts @@ -305,10 +305,11 @@ export class Coordinator { }; getRelayUrl = (network: 'mainnet' | 'testnet', hostUrl: string, selfHosted: boolean): string => { + const protocol = hostUrl.includes('https') ? 'wss' : 'ws'; if (selfHosted && this.shortAlias !== 'local') { - return `ws://${hostUrl.replace(/^https?:\/\//, '')}/${network}/${this.shortAlias}/relay/`; + return `${protocol}://${hostUrl.replace(/^https?:\/\//, '')}/${network}/${this.shortAlias}/relay/`; } else { - return `ws://${this.url.replace(/^https?:\/\//, '')}/relay/`; + return `${protocol}://${this.url.replace(/^https?:\/\//, '')}/relay/`; } }; }