Howto: Automatically disconnect clients after 30 minutes of inactivity

How can I achieve this? I just had to restart my app as I had 43 clients connected to it though no one was on the website (according to Mixpanel and GA realtime analytics). It seems memory isn’t released and my 512 MB on Galaxy were full, so the app become unresponsive and unavailable (red status for container at Galaxy).

I’d like to automatically kick out user after 30 minutes of inactivity, also for security reasons (like many other websites do).

How can this be achieved, I’m pretty sure others have come across the same problem already.

Thanks in advance for your help!

1 Like

There’s a package on atmosphere called userstatus or something like that. I’d check out the code how they do it seeing if user is idle. Worth a shot. But inactive really depends on what you consider inactive. Not performing any actions via methods, not calling any frontend methods, not doing anything at all, i. e. no mouse movement?

Thanks @AndreasGalster - I’ve installed that package already a while ago. Have to check if I can use the data that package write to come up with an easy solution.

Inactivity would definitely mean no action, so no mouse movement, no clicking. If there are no methods fired and no subs being asked that should be easy to monitor.

I was hoping somebody build a package around this already. Again, thank for your comment, appreciated

@a4xrbj1 @AndreasGalster I think you guys are looking for


Yes, that’s exactly what I was looking for and it indeed closes a security hole when people leave their browser open and don’t log out

1 Like

@a4xrbj1 can you share the code on how you used the package? i’m a little confused on to use it

You just install it and copy the settings into your settings.json file. I
didn’t even change the settings

[ 20char]

Is it normal for a Meteor app to only be able to handle 43 concurrent users per 512gb server?

Completely depends on how you are managing data subscriptions, how much data is being sent to the clients, how much you are processing etc… Way too many variables to make a guess with the limited detail you gave. Although 43 concurrent users on one server does sound very low. Install Kadira and see what is holding your app back.

How many max concurrent users/server do you commonly see?

I wonder how you can use Kadira to do all this optimization? I’ve installed the free version and apart from some nice graphs, pub/sub and methods timing it’s unclear to me how one can use Kadira to solve the problem that @vikr00001 has. Are there some training videos available? I’ve seen only one from Kadira which wasn’t really clear to me, but to Arunoda it’s probably easy as he designed the app (same way as my own app is so natural to me and others won’t understand fully either).

Actually the original poster is @a4xrbj1. :slight_smile: At the same time, I’m very interested in finding out more about these topics for an app I am developing.