Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f5198c0
Optionally return 409 when trying to join a second time
nickvergessen May 15, 2020
5e6a21b
Also support guests to prevent breaking their sessions
nickvergessen May 15, 2020
d5c42d8
Return session id, in call flag and last ping
nickvergessen May 15, 2020
9db6853
Always ask if we can join if we are not reloading the page
nickvergessen May 29, 2020
6b36032
Ask for confirmation to join in case of session conflict
nickvergessen May 29, 2020
cd81c6e
Automatically force join if the session is "old"
nickvergessen May 29, 2020
da78e4c
Add documentation for the conflict handling
nickvergessen May 29, 2020
5bce99b
Leave the room with the old session
nickvergessen May 29, 2020
ee2632b
Further pass on the sessionId to leaveRoomAsParticipant
nickvergessen Jun 15, 2020
61134a0
Handle duplicated sessions more gracefully with the internal signaling
nickvergessen Apr 16, 2020
dd48b52
Better handle 404 error as well as all other undefined scenarios
nickvergessen Apr 16, 2020
9fc01a6
Show session conflict warning when a session joins again for your own…
nickvergessen Jun 15, 2020
9775215
Redirect to a plain page to avoid reconnections
nickvergessen Jun 16, 2020
237d2f5
Send a signal to disconnect the old session before killing it
nickvergessen Jun 16, 2020
5f83e23
Don't show call state when asking to kill the other session
nickvergessen Jun 16, 2020
389d7b6
Trigger a vue event when SessionStorage "joined_conversation" changes
nickvergessen Jun 24, 2020
d54249f
Don't kill the previous session when we navigate away
nickvergessen Jun 24, 2020
eba73a3
Handle the disinvite event properly when the session was kicked
nickvergessen Jun 24, 2020
0f2176b
Add a hack to check if the dialog was closed via the X
nickvergessen Jun 29, 2020
1efead6
If the user has no participant anymore, it was not a conflict
nickvergessen Jun 29, 2020
0c729f0
Fix mixin state also when the component is loaded after the state alr…
nickvergessen Jun 30, 2020
e5c75cb
Update the session and the call flag when force joining
nickvergessen Jul 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Better handle 404 error as well as all other undefined scenarios
404: now redirects to /not-found
*: now retries after 10 seconds and shows an error
   and give up after 5 minutes recommending a reload

Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Jul 1, 2020
commit dd48b52ed9c2c1ffff187ada68a61d24fd5671d1
33 changes: 25 additions & 8 deletions src/utils/signaling.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ function Internal(settings) {
this.hideWarning = settings.hideWarning
this.spreedArrayConnection = []

this.pullMessageErrorToast = null
this.pullMessagesFails = 0
this.pullMessagesRequest = null

Expand Down Expand Up @@ -409,6 +410,11 @@ Signaling.Internal.prototype._startPullingMessages = function() {
request(token)
.then(function(result) {
this.pullMessagesFails = 0
if (this.pullMessageErrorToast) {
this.pullMessageErrorToast.hideToast()
this.pullMessageErrorToast = null
}

result.data.ocs.data.forEach(message => {
this._trigger('onBeforeReceiveMessage', [message])
switch (message.type) {
Expand Down Expand Up @@ -436,6 +442,7 @@ Signaling.Internal.prototype._startPullingMessages = function() {
} else if (axios.isCancel(error)) {
console.debug('Pulling messages request was cancelled')
} else if (error.response && error.response.status === 409) {
// Participant joined a second time and this session was killed
console.error('Session was killed but the conversation still exists')
this._trigger('pullMessagesStoppedOnFail')

Expand All @@ -460,22 +467,32 @@ Signaling.Internal.prototype._startPullingMessages = function() {
}
)
} else if (error.response && (error.response.status === 404 || error.response.status === 403)) {
console.error('Stop pulling messages because room does not exist or is not accessible')
this._trigger('pullMessagesStoppedOnFail')
// Conversation was deleted or the user was removed
console.error('Conversation was not found anymore')
OC.redirect(generateUrl('/apps/spreed/not-found'))
} else if (token) {
if (this.pullMessagesFails >= 3) {
console.error('Stop pulling messages after repeated failures')

this._trigger('pullMessagesStoppedOnFail')
if (this.pullMessagesFails === 1) {
this.pullMessageErrorToast = showError(t('spreed', 'Lost connection to signaling server. Trying to reconnect.'), {
timeout: -1,
})
}
if (this.pullMessagesFails === 30) {
if (this.pullMessageErrorToast) {
this.pullMessageErrorToast.hideToast()
}

// Giving up after 5 minutes
this.pullMessageErrorToast = showError(t('spreed', 'Lost connection to signaling server. Try to reload the page manually.'), {
timeout: -1,
})
return
}

this.pullMessagesFails++
// Retry to pull messages after 5 seconds
// Retry to pull messages after 10 seconds
window.setTimeout(function() {
this._startPullingMessages()
}.bind(this), 5000)
}.bind(this), 10000)
}
}.bind(this))
}
Expand Down