Managing user sessions |
Quote:If I set expire_on_close to true and then test the session when a new CI instrance is created and the user has closed their session can I assume safely they no longer have a browser open on our site? The question is a non sequitur because creating a new CI instance means that a browser has sent a request to your server. Clearly somebody has a browser open on your site. If the request comes from a user who previously established a session, and that session has expired (a.k.a. "closed") since the last request, then any data stored by the previous session is unavailable. It does not matter why the session expired - due to 'expire_on_close' or it timed out - expired is expired. In your first post you state: Code: I would like to be able to test whether they have a current browser connection You might have a mistaken idea about how browser and servers work together via HTTP. A browser sends an HTTP request and the web server sends a reply at which point the deal is done and the server forgets all about it. No kind of persistent connection exists. Web browsing is a stateless protocol. You also stated the following in your first post: Quote:I have read about garbage collection of sessions which seems to suggest the session_id is not a guarantee of their session being open. I wonder, is this the main reason for your post? If so, you should know that your session won't be "garbage collected" unless the session has expired. Rest assured that if your browser presents a valid session cookie to the server the server will be able to access data saved to that session. The caveat being you have to configure the CI session class correctly. It appears you have done that. |
Messages In This Thread |
Managing user sessions - by PaulC - 10-26-2017, 05:31 AM
RE: Managing user sessions - by dave friend - 10-26-2017, 10:28 AM
RE: Managing user sessions - by PaulC - 10-27-2017, 05:18 AM
RE: Managing user sessions - by dave friend - 10-27-2017, 09:54 AM
RE: Managing user sessions - by PaulC - 10-27-2017, 12:40 PM
RE: Managing user sessions - by dave friend - 10-27-2017, 02:39 PM
|