List logged users

List logged users

  
Hello,

Is there anyway to list all logged in user at a certain period of time?
I already checked the User Entity, but there's only the LastLogin information.

Thanks in advance,

Vitor R.
As Far As I Know there is no build-in functionality for checking this.
What you can probably do is to build your own action for this.

If you want to know how many users are logged in: enhance your login routine with a session variable that increments when someone logs in and decrements when someone logs out.

If you want to know which users are logged in then you should create a structure to hold the userID; again add to it when someone logs in and remove it when someone logs out.

Both ideas are not 100% reliable because not every user logs out the way it is supposed to be: for instance they just close their internet browser.
Hi,
 
anyone can tell me if at this moment exist some function that already can check if a User remains logged or not?
 
Thanks.
You could write some Advanced SQL that queries the Session DB and looks at which user IDs have active sessions.

Or you could write a piece of JavaScript and put it on your pages that periodially (once a minute or so) calls the server and says "Hi, this is my user id!", log that to a DB with the most recent time... and then you query for all records where it was less than, say, 90 seconds or 3 minutes or whatever since that person's session checked in.

J.Ja
Thank you Justin,

i like the first approach, where can I find the Session DB? I already search on the systems reference for that DB but I didn't saw her.

regards,
Goncalo -

It won't show in the list, you'll need to directly reference it in the Advanced SQL which is not ideal.

J.Ja
On your login screen, add an action to create an entity record for this user with an expiration date (20 minutes is the default session timeout).

On every request, possibly with a cache to avoid hammering the server, update the record to extend the expiration date.

Periodically, every 5 minutes or so, purge every expired user.

List this table.



Bottom line, you have nothing built-in for this. You'll need to address this requirement in your application.