ws-fallback: prevent signaling from stopping on reconnect. Do not stop to signal until both devices have sent event "peer-connected"

This commit is contained in:
schlagmichdoch 2023-03-03 12:40:41 +01:00
parent d6ef5887dd
commit bbb8c1b10f

View file

@ -707,15 +707,15 @@ class WSPeer extends Peer {
this._server.send(message); this._server.send(message);
} }
_sendSignal() { _sendSignal(connected = false) {
this.sendJSON({type: 'signal'}); this.sendJSON({type: 'signal', connected: connected});
} }
onServerMessage(message) { onServerMessage(message) {
Events.fire('peer-connected', {peerId: message.sender.id, connectionHash: this.getConnectionHash()}) 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._peerId = message.sender.id;
this._sendSignal(); this._sendSignal(true);
} }
getConnectionHash() { getConnectionHash() {