Skip to content
Merged
Show file tree
Hide file tree
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
Handle duplicated sessions more gracefully with the internal signaling
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Jul 1, 2020
commit 61134a0752c30b175d246be0d698f99998f41f86
12 changes: 11 additions & 1 deletion lib/Controller/SignalingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,17 @@ public function pullMessages(string $token): DataResponse {
$data[] = ['type' => 'usersInRoom', 'data' => $this->getUsersInRoom($room, $pingTimestamp)];
} catch (RoomNotFoundException $e) {
$data[] = ['type' => 'usersInRoom', 'data' => []];
return new DataResponse($data, Http::STATUS_NOT_FOUND);

// Was the session killed or the complete conversation?
try {
$this->manager->getRoomForParticipantByToken($token, $this->userId);

// Session was killed, make the UI redirect to an error
return new DataResponse($data, Http::STATUS_CONFLICT);
} catch (RoomNotFoundException $e) {
// Complete conversation was killed, bye!
return new DataResponse($data, Http::STATUS_NOT_FOUND);
}
}

return new DataResponse($data);
Expand Down
30 changes: 29 additions & 1 deletion src/utils/signaling.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ import { rejoinConversation } from '../services/participantsService'
import CancelableRequest from './cancelableRequest'
import { EventBus } from '../services/EventBus'
import axios from '@nextcloud/axios'
import { generateOcsUrl, generateUrl } from '@nextcloud/router'
import {
generateOcsUrl,
generateUrl,
} from '@nextcloud/router'
import {
showError,
showWarning,
} from '@nextcloud/dialogs'
import SessionStorage from '../services/SessionStorage'

const Signaling = {
Base: {},
Expand Down Expand Up @@ -431,6 +435,30 @@ Signaling.Internal.prototype._startPullingMessages = function() {
// User navigated away in the meantime. Ignore
} else if (axios.isCancel(error)) {
console.debug('Pulling messages request was cancelled')
} else if (error.response && error.response.status === 409) {
console.error('Session was killed but the conversation still exists')
this._trigger('pullMessagesStoppedOnFail')

OC.dialogs.confirmDestructive(
t('spreed', 'You joined the conversation in another window or device. This is currently not supported by Nextcloud Talk. What do you want to do?'),
t('spreed', 'Duplicate session'),
{
type: OC.dialogs.YES_NO_BUTTONS,
confirm: t('spreed', 'Restart here'),
confirmClasses: 'error',
cancel: t('spreed', 'Leave this page'),
},
decision => {
if (!decision) {
// Cancel
SessionStorage.removeItem('joined_conversation')
window.location = generateUrl('/apps/spreed')
} else {
// Confirm
window.location = generateUrl('call/' + token)
}
}
)
} 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')
Expand Down