Check protocol

This commit is contained in:
koalasat
2025-05-20 14:06:24 +02:00
parent 5fd0758308
commit ac0c489da2

View File

@ -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/`;
}
};
}