The timing of client connecting to server and getting all server sessions

Apr 26, 2012 at 8:32 AM

Hi Kerry,

I have a question regarding connection of client connecting to server, and get all server side sessions. My understanding is that after a client connects to server. The "connections" becomes a session on server side, and is accessible by calling GetAllSessions() of AppServer class.

If that's the case, I find the timing of calling GetAllSessions() does not seem reliable if calling it too soon.

I create client in a background thread, and server is running in main thread. This is pseudo code:

Main thread:


Create server;

Start client thread;

Wait client connects to server. (Use a Semaphore )

Call GetAllSessions(); some more work...


Client thread:


Create client with event handler to handle connection open

Open connection, and wait for the connection open event (for example,   Opened += new EventHandler(webSocketClient_Opened);)

After receiving the connection open event, the signal main thread to continue (Use the Semaphore)



I find that GetAllSessions(); is not able to get server side session after client already confirmed connection is established. If I step into above code (slow), then GetAllSessions() is able to get a session().

Is my understanding about the timing to call GetAllSession() correct?


Apr 26, 2012 at 9:46 AM

All sessions comes from session snapshot which is not updated realtime.