public WebSocketSession(
            WebSocketModule module, HttpListenerContext httpContext, WebSocketContext webSocketContext,
            CancellationToken cancellationToken, ISegmentBufferManager bufferManager, Encoding encoding)
        {
            if (module == null)
            {
                throw new ArgumentNullException("module");
            }
            if (httpContext == null)
            {
                throw new ArgumentNullException("httpContext");
            }
            if (webSocketContext == null)
            {
                throw new ArgumentNullException("webSocketContext");
            }
            if (bufferManager == null)
            {
                throw new ArgumentNullException("bufferManager");
            }
            if (encoding == null)
            {
                throw new ArgumentNullException("encoding");
            }

            _httpContext           = httpContext;
            this.Module            = module;
            this.Context           = webSocketContext;
            this.CancellationToken = cancellationToken;
            _bufferManager         = bufferManager;
            this.Encoding          = encoding;

            _sessionKey    = Guid.NewGuid().ToString();
            this.StartTime = DateTime.UtcNow;
        }
 public WebSocketSession(
     WebSocketModule module, HttpListenerContext httpContext, WebSocketContext webSocketContext,
     CancellationToken cancellationToken, ISegmentBufferManager bufferManager)
     : this(module, httpContext, webSocketContext,
            cancellationToken, bufferManager, Encoding.UTF8)
 {
 }