Similar to what @jshaffstall says, something like this may work:
- When a user signs in, it calls a server function called
new_sign_in - The
new_sign_infunction gets the session id withanvil.server.get_session_id()and stores it in theUserstable - Every time the app does a server call, every server callable checks if the
anvil.server.get_session_id()matches the session id stored in theUserstable, and…
– if it doesn’t, it will return an error to let the form know that it needs to sign out
– if it does, it will do its job and return whatever it needs to return - Optionally, a timer in the form calls the server function called
check_other_sign_inevery 5 seconds, and if the function returnsTrue, the app shows a notification and signs out