D.Tkalcec (RTC)
|
|
« 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
|