public RemoteSessionSocketHandler(HttpContext context, bool binary, string clientId, WebSocketDirection direction) : base() { _session = context.Session; Binary = binary; Direction = direction; try { if (context.Session[HttpSessionStateVariables.RemoteSession.ToString()] == null) { throw new NullReferenceException(); } // retrieve the remote session for the given http session _remoteSession = (RemoteSession)context.Session[HttpSessionStateVariables.RemoteSession.ToString()]; if (!_remoteSession.Manager.Clients.ContainsKey(clientId)) { lock (_remoteSession.Manager.ClientsLock) { _remoteSession.Manager.Clients.Add(clientId, new RemoteSessionClient(clientId)); } } _client = _remoteSession.Manager.Clients[clientId]; } catch (Exception exc) { Trace.TraceError("Failed to initialize socket handler ({0})", exc); } }
public RemoteSessionSocketHandler(HttpContext context, bool binary, WebSocketDirection direction) : base() { _session = context.Session; Binary = binary; Direction = direction; try { if (context.Session[HttpSessionStateVariables.RemoteSession.ToString()] == null) { throw new NullReferenceException(); } // retrieve the remote session for the given http session _remoteSession = (RemoteSession)context.Session[HttpSessionStateVariables.RemoteSession.ToString()]; } catch (Exception exc) { Trace.TraceError("Failed to retrieve the remote session for the http session {0}, ({1})", context.Session.SessionID, exc); return; } var clientId = context.Session.SessionID; if (context.Request.Cookies[HttpRequestCookies.ClientKey.ToString()] != null) { clientId = context.Request.Cookies[HttpRequestCookies.ClientKey.ToString()].Value; } if (!_remoteSession.Manager.Clients.ContainsKey(clientId)) { lock (_remoteSession.Manager.ClientsLock) { _remoteSession.Manager.Clients.Add(clientId, new RemoteSessionClient(clientId)); } } _client = _remoteSession.Manager.Clients[clientId]; }
public RemoteSessionSocketHandler(HttpSessionState session, bool binary, WebSocketDirection direction) : base() { _session = session; Binary = binary; Direction = direction; try { if (session[HttpSessionStateVariables.RemoteSession.ToString()] == null) { throw new NullReferenceException(); } // retrieve the remote session for the given http session _remoteSession = (RemoteSession)session[HttpSessionStateVariables.RemoteSession.ToString()]; } catch (Exception exc) { Trace.TraceError("Failed to retrieve the remote session for the http session {0}, ({1})", session.SessionID, exc); } }