summaryrefslogtreecommitdiff
path: root/client-web/source/protocol/mod.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-01-27 19:59:39 +0100
committermetamuffin <metamuffin@disroot.org>2024-01-27 19:59:39 +0100
commit91259369b2b87eb647e9743c874d7e58894149c1 (patch)
treec717d3c4fb3322bb559a50eab1a2331f9c351a70 /client-web/source/protocol/mod.ts
parent0d8a3082fe32e9dd89deea9f051f6e53df591646 (diff)
downloadkeks-meet-91259369b2b87eb647e9743c874d7e58894149c1.tar
keks-meet-91259369b2b87eb647e9743c874d7e58894149c1.tar.bz2
keks-meet-91259369b2b87eb647e9743c874d7e58894149c1.tar.zst
handle room joins without page reload.
Diffstat (limited to 'client-web/source/protocol/mod.ts')
-rw-r--r--client-web/source/protocol/mod.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/client-web/source/protocol/mod.ts b/client-web/source/protocol/mod.ts
index 690805c..e82cf94 100644
--- a/client-web/source/protocol/mod.ts
+++ b/client-web/source/protocol/mod.ts
@@ -43,7 +43,7 @@ export class SignalingConnection {
}
on_open() {
log("ws", "websocket opened");
- setInterval(() => this.send_control({ ping: null }), 30000) // stupid workaround for nginx disconnecting inactive connections
+ setInterval(() => this.send_control({ ping: null }), 30000) // stupid workaround for reverse proxies disconnecting inactive connections
}
async join(room: string) {
@@ -57,7 +57,13 @@ export class SignalingConnection {
log({ scope: "ws", error: true }, "websocket error occurred!")
}
async on_message(data: string) {
- const packet: ClientboundPacket = JSON.parse(data) // TODO dont crash if invalid
+ let packet: ClientboundPacket
+ try {
+ packet = JSON.parse(data)
+ } catch (_e) {
+ log({ scope: "ws", warn: true }, "server sent invalid json")
+ return
+ }
this.control_handler.dispatch(packet)
if (packet.init) this.my_id = packet.init.your_id;
if (packet.message) {