From bbb8c1b10f3a79fbfe5f07cdb4f8186eafa2f854 Mon Sep 17 00:00:00 2001 From: schlagmichdoch Date: Fri, 3 Mar 2023 12:40:41 +0100 Subject: [PATCH] ws-fallback: prevent signaling from stopping on reconnect. Do not stop to signal until both devices have sent event "peer-connected" --- public_included_ws_fallback/scripts/network.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public_included_ws_fallback/scripts/network.js b/public_included_ws_fallback/scripts/network.js index 1397a1a..e65f270 100644 --- a/public_included_ws_fallback/scripts/network.js +++ b/public_included_ws_fallback/scripts/network.js @@ -707,15 +707,15 @@ class WSPeer extends Peer { this._server.send(message); } - _sendSignal() { - this.sendJSON({type: 'signal'}); + _sendSignal(connected = false) { + this.sendJSON({type: 'signal', connected: connected}); } onServerMessage(message) { Events.fire('peer-connected', {peerId: message.sender.id, connectionHash: this.getConnectionHash()}) - if (this._peerId) return; + if (message.connected) return; this._peerId = message.sender.id; - this._sendSignal(); + this._sendSignal(true); } getConnectionHash() {