diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-08-20 15:32:10 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-08-20 15:32:10 +0300 |
commit | e83f185b9aaf527128f2981ca07b2600d284fce1 (patch) | |
tree | cd5c8f2dc1da9f3f3de5e40e61297cf1a1748484 /src/utils/signaling.js | |
parent | ccf091c78d7f857475ebd9ddf1fb70dc0382ddc5 (diff) |
Fix forced reconnections for guests when the HPB is used
When a reconnection is forced and the standalone signaling server is
used the participant joins again the conversation to get a new session,
and then the websocket to the standalone signaling server is closed,
which causes the reconnection with the signaling server. However, when
the participant is a guest and joins again the previous session gets a
"disinvite" message, which causes the browser to be redirected to the
main Talk page.
Due to this, now the "disinvite" message will be ignored when a forced
reconnection is started until the socket has reconnected. It seems that
the "disinvite" message will always be delivered before the request to
rejoin a conversation returns, so the flag could be disabled as soon as
the request returned instead of when the socket is connected. However,
disabling it once the socket has connected again is also logical and
seems more future proof.
In any case, as the "disinvite" message is ignored that means that if a
participant is actually kicked out from the conversation while
performing a forced reconnection the browser will not be aware of it and
a wrong UI would be shown. However, the chance of that happening is
quite low.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'src/utils/signaling.js')
-rw-r--r-- | src/utils/signaling.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/signaling.js b/src/utils/signaling.js index 6749f0c96..746fe7dbf 100644 --- a/src/utils/signaling.js +++ b/src/utils/signaling.js @@ -569,6 +569,7 @@ Signaling.Standalone.prototype.connect = function() { this.pendingMessages = [] this.connected = false this._forceReconnect = false + this._isRejoiningConversationWithNewSession = false this.socket = new WebSocket(this.url) window.signalingSocket = this.socket this.socket.onopen = function(event) { @@ -725,6 +726,8 @@ Signaling.Standalone.prototype.forceReconnect = function(newSession, flags) { this.leaveCall(this.currentCallToken, true) } + this._isRejoiningConversationWithNewSession = true + rejoinConversation(this.currentRoomToken) .then(response => { this.nextcloudSessionId = response.data.ocs.data.sessionId @@ -1123,6 +1126,10 @@ Signaling.Standalone.prototype.processRoomListEvent = function(data) { switch (data.event.type) { case 'disinvite': if (data.event.disinvite.roomid === this.currentRoomToken) { + if (this._isRejoiningConversationWithNewSession) { + console.debug('Rejoining conversation with new session, "disinvite" message ignored') + return + } console.error('User or session was removed from the conversation, redirecting') EventBus.$emit('duplicateSessionDetected') break |