What I’m trying to do:
I’m trying to take my app offline so users can’t login while I edit tables
What I’ve tried and what’s not working:
I’ve stopped the app in the editor, but users can still use the app.
What I’m trying to do:
I’m trying to take my app offline so users can’t login while I edit tables
What I’ve tried and what’s not working:
I’ve stopped the app in the editor, but users can still use the app.
You can create a form with a label that says that the app is offline and make it the startup form.
When you are done, you make the official startup form the startup form again.
Thanks! I’ll give it a try!
Note: That approach will stop users from logging in. It is not going to force already-logged-in users to log out. Is that likely to be an issue?
That won’t be a problem for now, but how could I force a logoff of already-logged-in users?
Thanks!
There’s already a log-out function (see the docs) that the Client can use.
The bigger question is, when to use it? You might, for example, run a status check, on a timer, periodically calling back to the server to find out whether there is scheduled downtime, and if so, when.
Near as I can tell, that information would have to be stored in the database. If you just put the flag in your next version’s startup code, well, they won’t be executing that until after they update. To be visible to older versions, it has to be in the database.
I think he’s looking for something that tells the server to consider all the users logged out.
There is no way for the server to contact all the clients and log them out, but perhaps the server can update something on the Users table so that the next time any client that thinks its signed in contacts the server, the server will tell the client that its session is expired.
Do you know if there is a column on the Users table that can be used to reset the session for every user?
Just looked. Didn’t see one. I ended up creating my own table to record “heartbeat” calls from each logged-in Client:
I’m allowing multiple rows per user, in case they log in from several browser tabs at once. The row itself serves as a “session id”.
A server-side logout function removes the logged-in user’s row from the table, after logging them out. Of course, if the user simply closes the browser, in lieu of logging out, then the logout function is never called, and that row will remain. But after the given expiration timestamp, you can consider them to be effectively logged out.
A periodic sweep of the table (scheduled task) keeps it from getting overgrown with expired records.
Edit: this feels redundant. Anvil already does something similar internally, and much more efficiently.