Class ByteStreamWriter
- Namespace
- LiveKit.Rtc
- Assembly
- LivekitRtc.dll
Writer for byte data streams.
public class ByteStreamWriter : IAsyncDisposable, IDisposable
- Inheritance
-
ByteStreamWriter
- Implements
- Inherited Members
Properties
Info
Gets the stream info.
public ByteStreamInfo Info { get; }
Property Value
Methods
CloseAsync(string?, Dictionary<string, string>?)
Closes the stream.
public Task CloseAsync(string? reason = null, Dictionary<string, string>? attributes = null)
Parameters
reasonstringOptional reason sent to the readers in the stream trailer.
attributesDictionary<string, string>Attributes to update on the stream, sent in the trailer.
Returns
- Task
A task that completes once the server has acknowledged the trailer.
CloseAsync(string?, Dictionary<string, string>?, CancellationToken)
Closes the stream, with a token to abandon the wait for the server's acknowledgement.
public Task CloseAsync(string? reason, Dictionary<string, string>? attributes, CancellationToken cancellationToken)
Parameters
reasonstringOptional reason sent to the readers in the stream trailer.
attributesDictionary<string, string>Attributes to update on the stream, sent in the trailer.
cancellationTokenCancellationTokenAbandons the wait for the server's acknowledgement; the stream is closed anyway.
Returns
- Task
A task that completes once the server has acknowledged the trailer.
Dispose()
Closes the stream if it is still open (the trailer is sent; a failure is logged) and releases the writer.
public void Dispose()
DisposeAsync()
Closes the stream if it is still open and releases the writer.
public ValueTask DisposeAsync()
Returns
- ValueTask
A task that completes once the stream is closed.
WriteAsync(byte[], CancellationToken)
Writes bytes to the stream.
public Task WriteAsync(byte[] data, CancellationToken cancellationToken = default)
Parameters
databyte[]Bytes to send; large arrays are split into chunks.
cancellationTokenCancellationTokenCancels the send.
Returns
- Task
A task that completes once every chunk has been sent.