NetTalk Central

Author Topic: Counting users which are logged in  (Read 3296 times)

hkalmbach

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • Email
Counting users which are logged in
« on: March 14, 2016, 08:59:39 AM »
Hello,

I am looking for a way to count active users a webserver.
With active I mean not active sessions but logged in users.
The active sessions are not good for me because if a user logs out actively he is redirected to the index page, but this redirects him to the login form and this already starts a new session.
Therefore I only want to count the logged in users. I can do this in the login form, also count the users who actively log out.

But how do I correctly get the users which are logged out with a timeout by the webserver or these ones which just close the browser?

Thanks in advance.

Heinz

robirenz

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: Counting users which are logged in
« Reply #1 on: March 14, 2016, 10:32:38 AM »
I do that in the webhandler.

notifydeletesession embed.

you can do that there but you would need to save the sessionid somehow tied to your user in you login form so that you can log him out adequately.

Best Regards...

Roberto Renz

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Counting users which are logged in
« Reply #2 on: March 15, 2016, 02:50:22 AM »
Hi Heinz;

What are you really trying to do?

you're asking how to make a solution work, without detailing what problem you are trying to solve.

cheers
Bruce


hkalmbach

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • Email
Re: Counting users which are logged in
« Reply #3 on: March 15, 2016, 03:22:23 AM »
Hi Bruce,

I am trying to get the number of really working (logged in) people.

I have the problem that the current session value of the perfomance monitor does not give the correct count of these people because
- if a user logs out actively he is redirected to the login page. This already creates a new session. But if he does not log in he should not be counted. And its a too long time to wait until a timeout

If I use the way to count login's and logout's I don't get those who close the browser and these sessions which are deleted by the web server after a timeout.

Thanks in advance for a hint.

Cheers
Heinz

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Counting users which are logged in
« Reply #4 on: March 15, 2016, 04:16:36 AM »
Hi Heinz,

>> But if he does not log in he should not be counted. And its a too long time to wait until a timeout

How long a time is it? Should you shorten the Session Timeout?

How often are you going to check this number? Every time a user logs in?

cheers
Bruce

hkalmbach

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • Email
Re: Counting users which are logged in
« Reply #5 on: March 15, 2016, 04:59:16 AM »
Hi Bruce,

in the moment I have a timeout of 5 minutes. Its not possible to reduce this because then people cannot work in a normal way.

But if a user logs out actively he wants his licence to be freed at once. At least this would be the best. Its the way the application behaves as windows program. There also I build in a timeout, for those who forget to log out, but if they actively log out the licence is free at once.

Yes the manual counting I do in the ValidateUpdate of LoginForm and LogoutForm. But as I told, I don't get the ones who don't log out actively.

Cheers
Heinz

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Counting users which are logged in
« Reply #6 on: March 15, 2016, 06:16:30 AM »
The problem you have is that you can count logins and logouts, via the WebHandler method, SetSessionLoggedIn, but that
doesn't account for sessions which are just deleted in .NotifyDeleteSession. And you don't have access to the .SessionLoggedIn() method when doing a DeleteSession.

So the best option is likely just to count the items in the queue set to Logged in.

but that's a bit tricky to do, and depends on where you are when you are counting. So, hence the question, when exactly do you "need" this information? when you are validating a user's login perhaps?

cheers
Bruce