RTC Forums
November 24, 2024, 01:14:18 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
SessionOpen/close events on the server
Pages: [
1
]
« previous
next »
Print
Author
Topic: SessionOpen/close events on the server (Read 5326 times)
DPerkins
RTC License
Posts: 37
SessionOpen/close events on the server
«
on:
January 17, 2014, 11:40:51 AM »
I note that both TRtcHttpServer and TRtcServerModule both have SessionOpen/Close events. Is there any difference between the two and which one is preferred, if any?
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: SessionOpen/close events on the server
«
Reply #1 on:
January 17, 2014, 12:12:02 PM »
Sessions are not linked to requests and are handled by the TRtcHttpServer component, so the event on the TRtcHttpServer component is primary. But all OnSessionOpen/Close events are forwarded to all connected components with the same events registered, so you can implement the event handlers on any or all of them.
Best Regards,
Danijel Tkalcec
Logged
DPerkins
RTC License
Posts: 37
Re: SessionOpen/close events on the server
«
Reply #2 on:
January 17, 2014, 04:37:57 PM »
I've noticed that (auto)sessions on the server are only checked whenever a request is received. If I close my (only) client, then the server sessions persist and my server code still thinks there are clients connected/alive. Is there anything I can periodically call on the server to get it to recheck all open sessions and thus fire the SessionClose events?
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: SessionOpen/close events on the server
«
Reply #3 on:
January 17, 2014, 04:45:52 PM »
No. Session handling is automatic. The Server will clean up old Sessions when you try to access Sessions. This is true for AutoSessions as well as manual Sessions.
Best Regards,
Danijel Tkalcec
Logged
DPerkins
RTC License
Posts: 37
Re: SessionOpen/close events on the server
«
Reply #4 on:
January 17, 2014, 04:51:34 PM »
But my code doesn't get to know (via SessionClosed) that client sessions have closed because there has not been any requests for the past 30 minutes to trigger session expiry checking.
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: SessionOpen/close events on the server
«
Reply #5 on:
January 17, 2014, 05:42:37 PM »
This is only true if nobody is accessing the Server. The purpose of Sessions is to keep user info stored on the Server. And the purpose of Session cleaning is to clean up memory from old Sessions. It is not a way to know how much time has passed since the last time a user was active. If you need to know how much time has passed since the last time user was active, you can stored the time info in the session and check it when the user comes back.
Best Regards,
Danijel Tkalcec
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...