D.Tkalcec (RTC)
|
|
« Reply #1 on: April 25, 2017, 09:08:09 AM » |
|
Sessions have nothing to do with connections. Closing a connection does NOT and SHOULD NOT automatically close a Session. The purpose of a Session is to keep persistent information about each Client on the Server between requests, even if the Client closes the connection after every request, uses a proxy to send requests, or sends every request using a different connection.
You can close a Session manually on the Server by using the CloseSession method (as shown in that example Project). If a Session is NOT manually closed, the Session will expire on the Server (after set timeout - provided more than one Client is accessing the Server). If a Client tries to access the Session after it has expired (and was garbage-collected by the Server), the FindSession and HaveSession methods will both return FALSE on the Server, which means that the Session no longer exists.
When using remote functions, the Client is notified automatically about an expired Session the first time it makes a remote function call to the Server using an expired Session ID.
RTC Sessions are used with remote functions when you enable RTC Encryption, because RTC encryption requires the Server to remember the state of each Client between requests, which could be sent using different connections (for example - through a proxy, where the same connections are usually shared by multiple Clients). RTC Sessions can also be used to store any other information about the Client on the Server, but are otherwise NOT required for RTC remote functions to work.
If you are NOT using Remote Functions with RTC Encryption and you do NOT need to keep persistent information about each Client on the Server between connections, then you do NOT have to use RTC Sessions - even if you are using RTC remote functions.
Best Regards, Danijel Tkalcec
|