RTC Forums

Subscription => Support => Topic started by: HelgeLange on May 03, 2017, 12:30:15 AM



Title: Session list
Post by: HelgeLange on May 03, 2017, 12:30:15 AM
Hi Danijel,

short question : is there a session list the server module that I can search through and access the information. I know that I can access the session when a request comes in, but I'd like to access the session list and some information when I need it in the server process.

Thanks, Helge


Title: Re: Session list
Post by: D.Tkalcec (RTC) on May 03, 2017, 05:01:38 AM
Short answer: There are no methods or functions which would give you access to a list of Sessions.

Long answer: Even though you can check if a Session exists (if you know the Session ID) by using the HaveSession method and lock the Session for read/write access using the FindSession method (both accessible from any TRtcDataServer component descendant), you should ONLY use the FindSession method from events triggered by the Client owning the Session.

When a Session is locked for access, the Session object is moved from the internal Session list to the TRtcDataServer descendant component (where the FindSession method was called) and can NOT be accessed from any other place (FindSession would return FALSE, while HaveSession returns TRUE) until the Session is unlocked again.

If you need to access some user data from other threads (not by Clients owning each Session), you should store that data in a separate data structure (your own objects).

Best Regards,
Danijel Tkalcec


Title: Re: Session list
Post by: HelgeLange on May 03, 2017, 03:05:52 PM
OK, thanks... Not what I wanted to hear, but it is what it is :)