Fixing reading of the relative URL in RommConnection

This commit is contained in:
David Négrier 2021-03-31 16:38:51 +02:00
parent 651dfc63f4
commit e166c69b58
1 changed files with 1 additions and 4 deletions

View File

@ -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):'');