diff --git a/p2p.js b/p2p.js index d36a51d..646ea6b 100644 --- a/p2p.js +++ b/p2p.js @@ -175,11 +175,13 @@ class MeshNet { this._pendingPeer = { peer, peerId: remoteId, connected: answerSent }; } - joinFromRoomCode(code) { + joinFromRoomCode(code, _retries = 10) { const key = `rp2p_offer_${code.toUpperCase()}`; const offerStr = localStorage.getItem(key); if (!offerStr) { - console.error('Room not found:', code); + if (_retries > 0) { + setTimeout(() => this.joinFromRoomCode(code, _retries - 1), 500); + } return; } const offerData = JSON.parse(offerStr);