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); } }
private async Task LoadNewHeaderAsync(CancellationToken cancel) { await _webSocket.AwaitHeaderAsync(cancel).ConfigureAwait(false); _hasPendingFrames = HasPendingFrames(); }