djchrisblue Posted April 14, 2015 Share Posted April 14, 2015 Hello, I got a web app on a local web server. I got devices connected to the same network through Wi-Fi. each device make a login first so I can store the timestamp of the login in mysql table. devices are doing either - log out or - simply get out of the Wi-Fi zone without log out. in the 2nd case I still want to get the time it happens. What do you suggest to get a more or less accurate time of logout? Thanks in advance for help Chris Quote Link to comment Share on other sites More sharing options...
joel24 Posted April 14, 2015 Share Posted April 14, 2015 (edited) use ajax polling to send requests every x seconds to the server, when you initiate a session for a user then store that in a row in the database and each time this ajax request is received update that row to have "lastContactTime" set to the time of the ajax request... When a user logs in it will create a new row in the above table as it's a login request if they're logged out when they move outside of the network. or, if whilst logged into the site, they're required to be clicking new pages frequently, then you can just ensure on each page load whilst logged in, you can skip the ajax polling and update the lastContactTime field each time a page is loaded and a user is logged in. or i'm sure you could muster up a solution using socket.io though it may be overkill. Edited April 14, 2015 by joel24 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.