diff options
author | metamuffin <metamuffin@disroot.org> | 2023-09-07 19:17:49 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-09-07 19:17:49 +0200 |
commit | 2d0761b8932f11b01e241e2db3a8f08250efe878 (patch) | |
tree | 29814137e2960286d36f3ae4f7c20299eb6d22b0 /client-web | |
parent | 6f644481f397af070e2b91b69846e375caafdbda (diff) | |
download | keks-meet-2d0761b8932f11b01e241e2db3a8f08250efe878.tar keks-meet-2d0761b8932f11b01e241e2db3a8f08250efe878.tar.bz2 keks-meet-2d0761b8932f11b01e241e2db3a8f08250efe878.tar.zst |
new protocol
Diffstat (limited to 'client-web')
-rw-r--r-- | client-web/source/index.ts | 2 | ||||
-rw-r--r-- | client-web/source/protocol/mod.ts | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/client-web/source/index.ts b/client-web/source/index.ts index 8ae7e8f..639f0c9 100644 --- a/client-web/source/index.ts +++ b/client-web/source/index.ts @@ -14,7 +14,7 @@ import { SignalingConnection } from "./protocol/mod.ts"; import { Room } from "./room.ts" import { control_bar, info_br } from "./menu.ts"; -export const VERSION = "0.1.14" +export const VERSION = "0.2.0" export interface ClientConfig { appearance?: { diff --git a/client-web/source/protocol/mod.ts b/client-web/source/protocol/mod.ts index a7e1f63..83ee8cb 100644 --- a/client-web/source/protocol/mod.ts +++ b/client-web/source/protocol/mod.ts @@ -10,7 +10,7 @@ import { crypto_encrypt, crypto_seeded_key, crypt_decrypt, crypto_hash } from ". export class SignalingConnection { room!: string websocket!: WebSocket - signaling_id!: string + room_hash!: string key!: CryptoKey my_id?: number // needed for outgoing relay messages @@ -20,9 +20,9 @@ export class SignalingConnection { constructor() { } async connect(room: string): Promise<SignalingConnection> { this.key = await crypto_seeded_key(room) - this.signaling_id = await crypto_hash(room) + this.room_hash = await crypto_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)}`) + const ws_url = new URL(`${window.location.protocol.endsWith("s:") ? "wss" : "ws"}://${window.location.host}/signaling`) this.websocket = new WebSocket(ws_url) this.websocket.onerror = () => this.on_error() this.websocket.onclose = () => this.on_close() @@ -44,6 +44,7 @@ export class SignalingConnection { } on_open() { log("ws", "websocket opened"); + this.send_control({ join: { hash: this.room_hash } }) setInterval(() => this.send_control({ ping: null }), 30000) // stupid workaround for nginx disconnecting inactive connections } on_error() { |