RrVPfX9cPtw59FpC 1,304 October 28, 2014 Share October 28, 2014 Hey, there On everyone's profile, there is a statistic reading "Time spent online". My question is, how does the server know when we are online? It can't be when we have a tab open, because I have MLPF open almost always, even when I'm asleep. It also can't be when we "do" something, because the time it takes to process us doing things is pretty much zero seconds. So, what is it? How does the server determine when we are and are not online? 1 This signature was removed for being too obnoxious and arrogant. -Makusu2 By the way, if you're talking to me in a thread, please quote my previous post. Otherwise, I might not respond to you. Link to comment Share on other sites More sharing options...
Lato 246 October 28, 2014 Share October 28, 2014 If the session (your login) is active, then you're online. Sessions are destroyed when the page is closed or the user logs out. 2 Link to comment Share on other sites More sharing options...
RrVPfX9cPtw59FpC 1,304 October 28, 2014 Author Share October 28, 2014 If the session (your login) is active, then you're online. Sessions are destroyed when the page is closed or the user logs out.But that doesn't make sense... I never log out, even when I go to bed. 1 This signature was removed for being too obnoxious and arrogant. -Makusu2 By the way, if you're talking to me in a thread, please quote my previous post. Otherwise, I might not respond to you. Link to comment Share on other sites More sharing options...
Lato 246 October 28, 2014 Share October 28, 2014 But that doesn't make sense... I never log out, even when I go to bed. Even if you don't log out, when the page is closed the session is still destroyed. You stay logged in when you return because the website will save a cookie onto your computer. 2 Link to comment Share on other sites More sharing options...
Solution Jeric 46,851 October 28, 2014 Solution Share October 28, 2014 We store data server side not client (browser side), give it an "id", and let the client know (and pass back at every http request) that id. That is a session and it is controlled by server configuratyion, and various files in the software's file system. Sessions expire on the server side after a set time period where there are no more requests from the client side to the server. At this point the 'clock' stops ticking. More specifically, The UID or Session ID is stored in the session data, server-side, after successful identification. Then for every HTTP request we get from the client, the session id (given by the client) will point you to the correct session data (stored by our server) which contains the authenticated user id - that way your code will know what user it is talking to. An HTTP request to view http://mlpforums.com/topic/113359-time-spend-online-statistic/ will be point A in time. If you do nothing for 'x' minutes or hours (depending on server config) then the session is terminated. Let me know if that explains things. Also forgot to add cookies to my description. Danka @Lato 3 Link to comment Share on other sites More sharing options...
RrVPfX9cPtw59FpC 1,304 October 28, 2014 Author Share October 28, 2014 Even if you don't log out, when the page is closed the session is still destroyed. You stay logged in when you return because the website will save a cookie onto your computer. But I never close the tab. 1 This signature was removed for being too obnoxious and arrogant. -Makusu2 By the way, if you're talking to me in a thread, please quote my previous post. Otherwise, I might not respond to you. Link to comment Share on other sites More sharing options...
RrVPfX9cPtw59FpC 1,304 October 28, 2014 Author Share October 28, 2014 We store data server side not client (browser side), give it an "id", and let the client know (and pass back at every http request) that id. That is a session and it is controlled by server configuratyion, and various files in the software's file system. Sessions expire on the server side after a set time period where there are no more requests from the client side to the server. At this point the 'clock' stops ticking. More specifically, The UID or Session ID is stored in the session data, server-side, after successful identification. Then for every HTTP request we get from the client, the session id (given by the client) will point you to the correct session data (stored by our server) which contains the authenticated user id - that way your code will know what user it is talking to. An HTTP request to view http://mlpforums.com/topic/113359-time-spend-online-statistic/ will be point A in time. If you do nothing for 'x' minutes or hours (depending on server config) then the session is terminated. Let me know if that explains things. Also forgot to add cookies to my description. Danka @Lato Yep, that makes sense. Thanks! 2 This signature was removed for being too obnoxious and arrogant. -Makusu2 By the way, if you're talking to me in a thread, please quote my previous post. Otherwise, I might not respond to you. Link to comment Share on other sites More sharing options...
Jeric 46,851 October 28, 2014 Share October 28, 2014 I'll go ahead and close this out. 1 Link to comment Share on other sites More sharing options...
Recommended Posts