AwaitHeaderAsync() private method

private AwaitHeaderAsync ( CancellationToken cancellation ) : Task
cancellation System.Threading.CancellationToken
return Task
コード例 #1
0
        public override async Task <WebSocketMessageReadStream> ReadMessageAsync(CancellationToken cancel)
        {
            using (cancel.Register(Close, false))
            {
                await _connection.AwaitHeaderAsync(cancel).ConfigureAwait(false);

                if (_connection.IsConnected && _connection.CurrentHeader != null)
                {
                    WebSocketMessageReadStream reader = new WebSocketMessageReadRfc6455Stream(_connection);
                    foreach (var extension in _extensions)
                    {
                        reader = extension.ExtendReader(reader);
                    }
                    return(reader);
                }
                return(null);
            }
        }
コード例 #2
0
        private async Task LoadNewHeaderAsync(CancellationToken cancel)
        {
            await _webSocket.AwaitHeaderAsync(cancel).ConfigureAwait(false);

            _hasPendingFrames = HasPendingFrames();
        }