General help

How to check who is currently online in the system

 
 
Picture of Marcus Green
Re: How to check who is currently online in the system
Group Particularly helpful Moodlers

I believe the online users block tracks when people last accessed the system, i.e. they must have done something within the time limit, not simply have been logged in and done nothing. This is linked to the stateless nature of HTTP.

Nobody is ever actually "online" when accessing a web page, they can make a request to a website and they can store information in a cookie. Once the request is completed the server knows nothing about what they do subsequently until they make an additional request.

 
Average of ratings: -
Picture of Dean Leggo
Re: How to check who is currently online in the system
 

If you really want people who are currently online you could set up an ajax script to send something to the server every 10 seconds. I don't know but this could put a high load on your server.

 
Average of ratings: -
Picture of CoreDev Develop
Re: How to check who is currently online in the system
 

Dear All,

Thanks for the reply and suggestion. But, I don't think the ONLINE User blocks working properly. I have refresh my browser. Should I also clear my cookie? or temporary internet file? I can use the maintenance mode. But it will not work, because I really need to down the server, and I don't want user to lost anything before I shutdown. 

I have also done some testing using Apache JMeter for 50 users. I have tested 50 users Login and log off from Moodle.  Then, refresh my browser, and all the 50 users display under Online User blocks, and I need to wait for 15 mins for it to disappear.   

I agree that HTTP is stateless. As long if the user has not click log out, it will treated as Online even though they do nothing. 

But at least the ONline block should able to check if the user session has already after log out, then it should remove it from the list. I have used the news and announcement for the broadcast. But, I think it will still the best if we can do broadcast with small alert windows to tell the users to log out. 

Creating an ajax script may solve the problem, as you it may increase the server load. 

Has anyone else having the same problem and find the solution?

Thanks and Best Regards,

Yulstar

 
Average of ratings: -
Picture of Marcus Green
Re: How to check who is currently online in the system
Group Particularly helpful Moodlers

"As long if the user has not click log out, it will treated as Online even though they do nothing. "

This is not how the online block works. Because HTTP is stateless Moodle only treats a person as online if they have actually done something within the defined period. If they have not done anything then they will be treated as offline (even though they are logged in)

 
Average of ratings: -