Get connectionid on server side of Meteor Method

Is it possible to get a user’s connection id in the server side of a Meteor Method? I need to know a user’s connectionid when they call a specific Method so that I can know when that particular user disconnected so that I can clean up some data kept in memory for that user

Or if anyone else has another approach for what I’m looking to do, here’s my dilemma. I’m keeping some session data in memory on the server for a small group of users. What I’m trying to achieve is to know when the last user who belongs to the group who needs that session data disconnects, so that I can clean up that in memory session data. So if userA and userB call the Meteor Method for group 1, and userC calls the Method for group 2, I want to know when userA and userB have disconnected so I can remove the in memory data for group 1.

How about you use konecty:user-presence with observeChanges and handle when any user disconnects?

I’m not a huge fan of keeping active users in db, but that does look like it would work well for my needs so thanks for the tip. I also found this stackoverflow post from MDG staff which explains a method similar to that package. If I was just able to get a user’s connectionid in a server side Meteor Method callback I could keep that in memory and never hit db

well isn’t there a this.connection in a Meteor method? Check that out, it probably has what you want…