Test Results

About us

 user logout
Total posts: 4
 Author user logout
Peter Sippel

15.08.2006 12:11:57
Registered user

how can a http server notice, when a "logged in" user has closed his client without logging out by a function ?

When I use TRtcHttpServer.OnDisconnecting, I don't have access to the session infos.

TIA. Peter
Danijel Tkalcec [RTC]

15.08.2006 15:48:06
Registered user
First, since this is a HTTP protocol, a disconnect from the Server doesn't mean that the client has "logged out". With the HTTP protcol, you can either send each request using a separate connection, or send several requests using the same connection. The same way, when clients are using a Proxy server, more than one client could be sending his requests through a single open connection.

What you should do is use Sessions with timeouts for automatic memory cleanup and ... implement your login function so that it allows the same user to log in multiple times, so that a user won't be locked away if he logs in and doesn't log out using your "logout function".
Peter Sippel

15.08.2006 16:47:22
Registered user
Most forum sites I know do log me out automatically when I close my client. If I would start another one 1 second later, I would have to log in again.

How can THEY do that ?
Danijel Tkalcec [RTC]

15.08.2006 18:06:41
Registered user
Actually, there is nothing special they need to do. Since most forums send the Session ID as part of the URL, once you open the standard URL without that Session ID in it, you are not logged in anymore.

On the other hand, if you copy your complete URL to clipboard, close the Browser, open a new Browser and use that URL in the other Browser (paste in "Address"), you would most likely still be logged in and see the same page (unless your Session expires in the meantime).

When using Sessions with the RTC SDK, you specify a session "keep alive" period. If a Session is not used for longer than the specified "keep alive" period, data stored in that Session will be removed from memory and the user will no longer be registered as "logged in".

So, the only thing you need to do is use Sessions to remember that a user is logged in, and ... allow users to log in again, even if they are still "registered as logged in" somewhere else (for example, in your database).