Time-outs in LC Server?
Rick Harrison
harrison at all-auctions.com
Fri Jul 19 09:28:28 EDT 2019
Hi Alex,
> On Jul 18, 2019, at 6:55 PM, Alex Tweedly via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> You should never use 'send in time' or 'wait with messages' in LCServer.
>
> Each http request starts up your LC server script anew - and you need that request to be handled and the server-instance shut down as quickly as possible. And the next http request will start up another, entirely separate, instance; so you need to be storing some status info between requests.
>
> If a user doesn't do anything on the site for a few minutes, then you can use a flow something (vaguely) like :
>
> (at start of the script):
>
> - check if user is logged in (if not, prompt them to login / register / …)
I already check if the user is logged in so that part isn’t an issue.
>
> - check a database entry for when they were last active (up to you whether that's per-user, per user/per-IP address, or per-some-cookie, or ...)
>
> - if time-since-last-action is too long - log them out, and as appropriate, either
> a. apologise :-), and go to login screen
> b. return a "not logged in" error
>
> - if it is still within time, then update the "last active" database entry
>
> - then do the rest of the current request
I was hoping there was some global server value I could check
or if there was an LC message like “on Idle” that would work.
Perhaps setting a session variable and the sessionLifetime
to a particular duration. When the variable expires log the
show a sorry message due to timeout and have the
next button shown with the message log them out.
The following is a link to the javascript stuff I had referred
to before. I just want a clean LC way to do the same thing.
https://stackoverflow.com/questions/9564602/how-to-know-browser-idle-time?noredirect=1&lq=1
Thanks,
Rick
More information about the use-livecode
mailing list