Anvil default App timeout length?

The difference between a timer and a background task is not the overhead, it’s that the timer runs on the client, while the background task runs on the server.

A background task cannot contact the client, while a timer running on the client can call a server function to update a timestamp.

A background task, as suggested by @turnip12144, could be used to check if the client contacted the server in the past few seconds and log the session out.

In my opinion, I would keep things simpler: no timer, no background task. I would set the timestamp every time the app calls a server function. If the server call comes from a different session, then, if the timestamp is older than x minutes, I would log out the older session, otherwise I would show a dialog asking whether to log out the older session or cancel the current operation.

1 Like