From f3ae21c5c143e9966550eca85ea803944ec04351 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 11 Apr 2020 09:43:27 +0200 Subject: [PATCH] Display errors --- assets/js/components/calls/window.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/assets/js/components/calls/window.js b/assets/js/components/calls/window.js index 378fcdf3..2fde4d96 100644 --- a/assets/js/components/calls/window.js +++ b/assets/js/components/calls/window.js @@ -253,12 +253,23 @@ class CallWindow extends CustomEvents { config: this.callConfig() }) + // Forward signals this.mainPeer.on("signal", data => { - ws("call/signal", { + + const type = data.hasOwnProperty("sdp") ? "SDP" : "CANDIDATE"; + + ws("calls/signal", { callID: this.callID, peerID: userID(), - data: data + type: type, + data: type == "SDP" ? JSON.stringify(data) : JSON.stringify(data.candidate) }) }) + + // Return errors + this.mainPeer.on("error", err => { + console.error("Peer error!", err); + notify("An error occured while trying to connect!", "danger", 5) + }); } } \ No newline at end of file