Пример #1
0
        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();
        }
Пример #2
0
 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;
 }