public override WebSocketMessageReadStream ReadMessage()
        {
            Connection.AwaitHeader();

            if (Connection.IsConnected && Connection.CurrentHeader != null)
            {
                WebSocketMessageReadStream reader = new WebSocketMessageReadRfc6455Stream(this);
                foreach (var extension in _extensions)
                    reader = extension.ExtendReader(reader);
                return reader;
            }

            return null;
        }
        public override async Task<WebSocketMessageReadStream> ReadMessageAsync(CancellationToken token)
        {
            await Connection.AwaitHeaderAsync(token);

            if (Connection.IsConnected)
            {
                WebSocketMessageReadStream reader = new WebSocketMessageReadRfc6455Stream(this);
                foreach (var extension in _extensions)
                    reader = extension.ExtendReader(reader);
                return reader;
            }

            return null;
        }
        public override async Task <WebSocketMessageReadStream> ReadMessageAsync(CancellationToken token)
        {
            await this.Connection.AwaitHeaderAsync(token).ConfigureAwait(false);

            if (this.Connection.CanReceive && this.Connection.CurrentHeader != null)
            {
                WebSocketMessageReadStream reader = new WebSocketMessageReadRfc6455Stream(this);
                foreach (var extension in this.extensions)
                {
                    reader = extension.ExtendReader(reader);
                }
                return(reader);
            }
            return(null);
        }
Example #4
0
        public override WebSocketMessageReadStream ReadMessage()
        {
            Connection.AwaitHeader();

            if (Connection.IsConnected && Connection.CurrentHeader != null)
            {
                WebSocketMessageReadStream reader = new WebSocketMessageReadRfc6455Stream(this);
                foreach (var extension in _extensions)
                {
                    reader = extension.ExtendReader(reader);
                }
                return(reader);
            }

            return(null);
        }
        public override async Task<WebSocketMessageReadStream> ReadMessageAsync(CancellationToken token)
        {
            using (token.Register(this.Close, false))
            {
                await Connection.AwaitHeaderAsync(token).ConfigureAwait(false);

                if (Connection.IsConnected && Connection.CurrentHeader != null)
                {
                    WebSocketMessageReadStream reader = new WebSocketMessageReadRfc6455Stream(this);
                    foreach (var extension in _extensions)
                        reader = extension.ExtendReader(reader);
                    return reader;
                }
                return null;
            }
        }
Example #6
0
        public override async Task <WebSocketMessageReadStream> ReadMessageAsync(CancellationToken token)
        {
            using (token.Register(this.Close, false))
            {
                await Connection.AwaitHeaderAsync(token).ConfigureAwait(false);

                if (Connection.IsConnected && Connection.CurrentHeader != null)
                {
                    WebSocketMessageReadStream reader = new WebSocketMessageReadRfc6455Stream(this);
                    foreach (var extension in _extensions)
                    {
                        reader = extension.ExtendReader(reader);
                    }
                    return(reader);
                }
                return(null);
            }
        }