Class ByteStreamReader
- Namespace
- LiveKit.Rtc
- Assembly
- LivekitRtc.dll
Reader for byte data streams. Implements IAsyncEnumerable for modern async iteration patterns.
public class ByteStreamReader : IAsyncDisposable, IDisposable, IAsyncEnumerable<ReadOnlyMemory<byte>>
- Inheritance
-
ByteStreamReader
- Implements
- Inherited Members
Properties
Info
Gets the stream info.
public ByteStreamInfo Info { get; }
Property Value
Methods
Dispose()
Stops receiving: the chunks already received can still be read, then reads return null. Later chunks are dropped.
public void Dispose()
DisposeAsync()
Stops receiving: the chunks already received can still be read, then reads return null. Later chunks are dropped.
public ValueTask DisposeAsync()
Returns
- ValueTask
A completed task.
GetAsyncEnumerator(CancellationToken)
Returns an async enumerator for iterating over byte chunks.
public IAsyncEnumerator<ReadOnlyMemory<byte>> GetAsyncEnumerator(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
- IAsyncEnumerator<ReadOnlyMemory<byte>>
An async enumerator of byte chunks.
ReadAllAsync(CancellationToken)
Reads all remaining bytes from the stream.
public ValueTask<byte[]> ReadAllAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
ReadAsync(CancellationToken)
Reads the next chunk of bytes.
public ValueTask<ReadOnlyMemory<byte>?> ReadAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
- ValueTask<ReadOnlyMemory<byte>?>
The next byte chunk, or null if the stream is complete.
Exceptions
- StreamException
The sender or the room went away before the stream was closed.