public SessionHandler(HttpContext context, SessionFactory factory) { if (!context.IsWebSocketRequest) throw new ApplicationException("context is not a websocket context"); this.Context = context; this.Factory = factory; this.getSocket = context.AcceptWebSocketAsync(); }