ring

2019-12-02T14:32:17.040100Z

Hi, what is the common approach to deal with session timeouts? For instance when a user wake up laptop after a while. How should I detect on the client that session timeouted?

2019-12-04T05:32:40.042800Z

@weavejester But that is on the server, isn't it? Should I set a timeout on the client as well? How to deal with the situation when session is extended after a user action?

2019-12-05T11:11:07.043400Z

You can also set a timeout on the client. Some sites do, some sites don’t. If you want to, you’d take the timestamp from the session and generate some javascript to trigger a function after a timeout. To extend the timeout, you can just update the session value on user action.

2019-12-10T23:16:05.043800Z

How do I get a timestamp from the session? How is it stored on the client?

2019-12-10T23:18:05.044Z

@weavejester Our application is something close to Google Docs, so it is a tool which users should use over long periods of time. Ideally, after waking up laptop, it should get refreshed automatically and be ready to work.

2019-12-11T01:05:51.044200Z

You just generate the current date or timestamp and add it to the session. Are you asking how to generate a time in Clojure, or how to store things in the session?

2019-12-11T10:48:43.044400Z

So I store the time in the session on the server. How do I access it on the client?

2019-12-11T17:50:59.044600Z

You can generate a <script> tag in order to pass additional information to your client scripts. Or have the client make an Ajax call.

2019-12-12T02:15:37.044800Z

Ok, makes sense, I will try to build some prototype and will see how it works. Thanks.

2019-12-02T23:01:32.040200Z

You can store a timestamp when the session is created, and delete the session if it exceeds the timestamp.