Inform akka that user intentionality logged out from meeting

This commit is contained in:
Joao Siebel 2021-01-26 10:08:54 -03:00 committed by Aron Engineer
parent 0105373cee
commit c9650ba8f1
2 changed files with 5 additions and 4 deletions

View File

@ -18,9 +18,9 @@ export default function userLeaving(meetingId, userId, connectionId) {
userId,
};
const User = Users.findOne(selector);
const user = Users.findOne(selector);
if (!User) {
if (!user) {
Logger.info(`Skipping userLeaving. Could not find ${userId} in ${meetingId}`);
return;
}
@ -32,13 +32,14 @@ export default function userLeaving(meetingId, userId, connectionId) {
// If the current user connection is not the same that triggered the leave we skip
if (auth?.connectionId !== connectionId) {
Logger.info(`Skipping userLeaving. User connectionId=${User.connectionId} is different from requester connectionId=${connectionId}`);
Logger.info(`Skipping userLeaving. User connectionId=${user.connectionId} is different from requester connectionId=${connectionId}`);
return false;
}
const payload = {
userId,
sessionId: meetingId,
loggedOut: user.loggedOut,
};
ClientConnections.removeClientConnection(`${meetingId}--${userId}`, connectionId);

View File

@ -20,6 +20,6 @@ export default function userLeftMeeting() { // TODO-- spread the code to method/
ClientConnections.removeClientConnection(this.userId, this.connection.id);
}
} catch (err) {
Logger.error(`leaving dummy user to collection: ${err}`);
Logger.error(`Error on user left: ${err}`);
}
}