diff options
author | metamuffin <metamuffin@disroot.org> | 2022-09-09 10:39:13 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-09-09 10:39:13 +0200 |
commit | afed94bb4609bd796102c9184f13fa29c5f92a48 (patch) | |
tree | 6d40b78dcc6174e148cf5b9531366e3712c223f7 /client-web/source/room.ts | |
parent | 7c039b507695d0dbb8d00e583f7ce29b6925dcdc (diff) | |
download | keks-meet-afed94bb4609bd796102c9184f13fa29c5f92a48.tar keks-meet-afed94bb4609bd796102c9184f13fa29c5f92a48.tar.bz2 keks-meet-afed94bb4609bd796102c9184f13fa29c5f92a48.tar.zst |
server is only a relay now.
Diffstat (limited to 'client-web/source/room.ts')
-rw-r--r-- | client-web/source/room.ts | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/client-web/source/room.ts b/client-web/source/room.ts index c22a956..78454bb 100644 --- a/client-web/source/room.ts +++ b/client-web/source/room.ts @@ -5,7 +5,8 @@ import { RemoteUser } from "./remote_user.ts"; import { User } from "./user.ts"; import { LocalUser } from "./local_user.ts"; import { ServerboundPacket, ClientboundPacket } from "../../common/packets.d.ts"; - +import { PREFS } from "./preferences.ts"; +import { ep } from "./helper.ts"; export class Room { el: HTMLElement @@ -20,9 +21,19 @@ export class Room { this.name = name this.el = document.createElement("div") this.el.classList.add("room") - this.websocket = new WebSocket(`${window.location.protocol.endsWith("s:") ? "wss" : "ws"}://${window.location.host}/${encodeURIComponent(name)}/signaling`) + + const ws_url = new URL(`${window.location.protocol.endsWith("s:") ? "wss" : "ws"}://${window.location.host}/${encodeURIComponent(name)}/signaling`) + ws_url.searchParams.set("username", PREFS.username) + this.websocket = new WebSocket(ws_url) this.websocket.onclose = () => this.websocket_close() - this.websocket.onopen = () => this.websocket_open() + + // const connecting_text = ep("Upgrading to a websocket connection…") + // this.el.append(connecting_text) + + this.websocket.onopen = () => { + // connecting_text.remove() + this.websocket_open() + } this.websocket.onmessage = (ev) => { this.websocket_message(JSON.parse(ev.data)) } |