From e166c69b5877d96f4c55377e8bbf70a07ba3a659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Wed, 31 Mar 2021 16:38:51 +0200 Subject: [PATCH] Fixing reading of the relative URL in RommConnection --- front/src/Connexion/RoomConnection.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/front/src/Connexion/RoomConnection.ts b/front/src/Connexion/RoomConnection.ts index 0793851d..199e8f6a 100644 --- a/front/src/Connexion/RoomConnection.ts +++ b/front/src/Connexion/RoomConnection.ts @@ -67,10 +67,7 @@ export class RoomConnection implements RoomConnection { * @param roomId The ID of the room in the form "_/[instance]/[map_url]" or "@/[org]/[event]/[map]" */ public constructor(token: string|null, roomId: string, name: string, characterLayers: string[], position: PositionInterface, viewport: ViewportInterface) { - let url = PUSHER_URL; - if (url.startsWith('//')) { - url = window.location.protocol+url; - } + let url = new URL(PUSHER_URL, window.location.toString()).toString(); url = url.replace('http://', 'ws://').replace('https://', 'wss://'); url += '/room'; url += '?roomId='+(roomId ?encodeURIComponent(roomId):'');