Skip to content

Commit

Permalink
Fix pending forced reconnection after WebSocket reconnection
Browse files Browse the repository at this point in the history
When the WebSocket is disconnected from the external signaling server it
is automatically reconnected to it; if a forced reconnection with a new
session was queued while the WebSocket was disconnected it was supposed
to be performed as soon as it was reconnected. However,
"_forceReconnect" tracks whether there is a pending forced reconnection,
and as it was set to false when "Signaling.Standalone.connect()" was
called the queued forced reconnection never happened after a WebSocket
reconnection (which caused the previous session to be resumed instead of
a new one being created).

A forced reconnection with a new session is just a connection in which
no previous session ID is given to resume it. Instead of queuing a
forced reconnection now the session ID is cleared if forcing a
reconnection when the socket is disconnected (just like when forcing a
reconnection when the socket is connected), which fixes the issue
described above and also causes the socket to already connect with the
new session, instead of connecting with the previous one to then force
the reconnection with the new one.

"signalingRoomJoined" needs to be cleared too (like done in "sendBye")
to properly wait to join the call after the reconnection was done.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
  • Loading branch information
danxuliu authored and Backportbot committed Jul 22, 2019
1 parent b3f0c50 commit aa1ed87
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions js/signaling.js
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,8 @@
}

this._forceReconnect = true;
this.resumeId = null;
this.signalingRoomJoined = null;
return;
}

Expand Down

0 comments on commit aa1ed87

Please sign in to comment.