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(); }
public Session(SessionFactory factory, WebSocket ws) { this.Factory = factory; this.Id = Guid.NewGuid(); this.Socket = ws; this.Source = new CancellationTokenSource(); this.Buffer = new byte[BufferSize]; receiver = new ArraySegment<byte>(this.Buffer); this.Result = null; }