RTC Forums
May 18, 2024, 10:30:42 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Sessions parameters  (Read 3581 times)
wbroyles
RTC Expired
*
Posts: 21


« on: October 27, 2012, 02:44:23 PM »


I am trying to pass some information at the Session level using RtcHttpClient (with RtcClientModule) and RtcHttpServer (with RtcServerModule) . I am using Session.AsString['name'] := '123' as the method to set the value, but I am not clear on when (or what event) I can set to value on the Client side and what event I can capture the value on the Server side. I tried several different combinations but none seem to work.

AutoSesssion := True;
Delphi XE2
RTC 604


Thanks

Wade


 
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: October 28, 2012, 11:54:45 AM »

I think there is a basic missunderstanding about what Sessions are. Unlike remote functions, where you send data between the Client and the Server, Sessions are always local. Session data is never sent (at least not automatically) between Clients and the Server. The only information exchanged between the Client and the Server is the Session ID, which is used with Remote Functions on the Server to give you access to the Session related to that specific Session ID. With automatic Session handling, this means that any Client-related information you store inside the Session on the Server will be available to you on the Server for as long as the Session is active.

For example ... you write a remote function which you will use to authorize the user. In that remote function, the user will send its login credentials to the Server as normal parameters to the remote function. In the login remote function implementation on the Server, you will check if the user is allowed to access the Server, check what access rights the user would have and store that information inside the Session. Any information you store inside the Session on the Server will be available on the Server when you make other remote function calls from the same user using the same TRtcHttpClient component. This means that you can make other remote function calls to the Server without sending user credentials. Instead, in all these other remote functions, you will check the information stored inside the Session (on the Server, inside the OnExecute event) to decide what the user may or may not do.

Naturally, Sessions can be used to store any information you want on the Server. They can also be used to span complex processing information across several remote function calls. Just be aware that Sessions have a life-span. If a Session expires (which would happen if the Session has not been accessed for at least the duration specified for SessionLive), all the data stored inside the Session object will be destroyed.

Best Regards,
Danijel Tkalcec
Logged
wbroyles
RTC Expired
*
Posts: 21


« Reply #2 on: October 28, 2012, 02:45:16 PM »

Danijel,

You beat me to the punch. After further investigation, I realized I can do exactly what's  needed with the RtcFunctionInfo parameter and can tie objects to the session on the server.

I love the work you done!

Thank you,

Wade
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 16 queries.