using System.ClientModel; using System.Net.WebSockets; namespace BotSharp.Plugin.OpenAI.Providers.Realtime.Session; internal class AsyncWebsocketDataCollectionResult : AsyncCollectionResult { private readonly WebSocket _webSocket; private readonly CancellationToken _cancellationToken; public AsyncWebsocketDataCollectionResult( WebSocket webSocket, CancellationToken cancellationToken) { _webSocket = webSocket; _cancellationToken = cancellationToken; } public override ContinuationToken? GetContinuationToken(ClientResult page) { return null; } public override async IAsyncEnumerable GetRawPagesAsync() { await using var enumerator = new AsyncWebsocketDataResultEnumerator(_webSocket, _cancellationToken); while (await enumerator.MoveNextAsync().ConfigureAwait(false)) { yield return enumerator.Current; } } protected override async IAsyncEnumerable GetValuesFromPageAsync(ClientResult page) { await Task.CompletedTask; yield return page; } }