I’m trying to create a lightweight application that tracks respirator usage which essentially allows users to log in when they put on a respirator, and once they’re in the app records how long each specific user is logged in for. This way I can send a notification on when they should replace their respirator’s filter since their time wearing it is essentially their logged-in-duration. The idea is that once the user logs out, the application takes that duration and adds it to the user’s total time which is stored as a data table, and once a certain time-limit is reached, the user is emailed.
I read the documentation for sessions but was somewhat turned away due to the automatic session timeout that occurs after 30 minutes. Is there a way to either increase that timeout? Or would another implementation method be better since the target user will often have to wear the respirator for more than 30 minutes.
Not my discovery but as long as you get something from server, the server doesn’t get a time out.
So just create a timer which calls a server function after some minutes.
2 Likes
the way i do this is by logging dashboard session events with a timestamp every time someone clicks on something and i can measure the time between the session start and last event in that session.
i have a table called dashboard_sessions and a table called session_events. dashboard_sessions has a column called ‘event_sessions’ which is multi row link to session_events table.
1 Like
The only caveat with this potential solution is that I don’t want to make it so that the users have to just go onto their device and click a button every 30 minutes as it would disrupt their workflow (which this is trying to improve). Would I be able to doctor a user event in that case?
Using a timer, as divyeshlakhotia suggested, to call a do-nothing server function will keep the session alive. The timer could fire every 10 minutes or so, and would not require user interaction.
2 Likes
Some notes about the Timer approach:
- The timer must be on a form that is on-screen. If a different form takes its place, then the timer is suspended until it is returned to the screen.
- Depending on the browser, it may be necessary for the form’s browser tab to be active as well. I’ve seen signs lately that when a tab moves to the background, some browsers may put the entire tab “to sleep”, to conserve RAM and CPU time. In this state, the timer may not tick.
2 Likes