summaryrefslogtreecommitdiff
path: root/client-web/source/protocol/mod.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-09-09 12:02:09 +0200
committermetamuffin <metamuffin@disroot.org>2022-09-09 12:02:09 +0200
commitb25bbae82f9bfaf6f37dfb16e07708060dd3df55 (patch)
tree96e7d5df536598753efb07ad68d192a3f99b6e24 /client-web/source/protocol/mod.ts
parentb6d93e0f322901dfc1fee23f3d396a68e61e1b29 (diff)
downloadkeks-meet-b25bbae82f9bfaf6f37dfb16e07708060dd3df55.tar
keks-meet-b25bbae82f9bfaf6f37dfb16e07708060dd3df55.tar.bz2
keks-meet-b25bbae82f9bfaf6f37dfb16e07708060dd3df55.tar.zst
signaling id
Diffstat (limited to 'client-web/source/protocol/mod.ts')
-rw-r--r--client-web/source/protocol/mod.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/client-web/source/protocol/mod.ts b/client-web/source/protocol/mod.ts
index f86e96f..4fbd607 100644
--- a/client-web/source/protocol/mod.ts
+++ b/client-web/source/protocol/mod.ts
@@ -1,4 +1,5 @@
-import { crypto_seeded_key } from "./crypto.ts"
+import { log } from "../logger.ts"
+import { crypto_seeded_key, crypt_hash } from "./crypto.ts"
export class SignalingConnection {
room!: string
@@ -9,9 +10,14 @@ export class SignalingConnection {
constructor() { }
async connect(room: string): Promise<SignalingConnection> {
this.key = await crypto_seeded_key(room)
+ this.signaling_id = await crypt_hash(room)
+ log("ws", "connecting…")
const ws_url = new URL(`${window.location.protocol.endsWith("s:") ? "wss" : "ws"}://${window.location.host}/signaling/${encodeURIComponent(this.signaling_id)}`)
this.websocket = new WebSocket(ws_url)
await new Promise(r => this.websocket!.onopen = r)
+ log("ws", "connection opened")
return this
}
+
+
}