Skip to content
Snippets Groups Projects
Commit 09f5931d authored by Joao Siebel's avatar Joao Siebel
Browse files

Keep track of active connection id for users

parent 1564a7a9
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ import RedisPubSub from '/imports/startup/server/redis';
import Logger from '/imports/startup/server/logger';
import AuthTokenValidation from '/imports/api/auth-token-validation';
import Users from '/imports/api/users';
import ClientConnections from '/imports/startup/server/ClientConnections';
export default function userLeaving(meetingId, userId, connectionId) {
const REDIS_CONFIG = Meteor.settings.private.redis;
......@@ -40,6 +41,8 @@ export default function userLeaving(meetingId, userId, connectionId) {
sessionId: meetingId,
};
ClientConnections.removeClientConnection(`${meetingId}--${userId}`, connectionId);
Logger.info(`User '${userId}' is leaving meeting '${meetingId}'`);
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload);
}
......@@ -17,18 +17,8 @@ export default function userLeftMeeting() { // TODO-- spread the code to method/
if (numberAffected) {
Logger.info(`user left id=${requesterUserId} meeting=${meetingId}`);
ClientConnections.removeClientConnection(this.userId, this.connection.id);
}
ClientConnections.removeClientConnection(this.userId, this.connection.id);
Users.update(
selector,
{
$set: {
loggedOut: true,
},
},
cb,
);
} catch (err) {
Logger.error(`leaving dummy user to collection: ${err}`);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment