Table of Contents

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

ByteStreamInfo

Methods

CloseAsync(string?, Dictionary<string, string>?)

Closes the stream.

public Task CloseAsync(string? reason = null, Dictionary<string, string>? attributes = null)

Parameters

reason string

Optional reason sent to the readers in the stream trailer.

attributes Dictionary<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

reason string

Optional reason sent to the readers in the stream trailer.

attributes Dictionary<string, string>

Attributes to update on the stream, sent in the trailer.

cancellationToken CancellationToken

Abandons 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

data byte[]

Bytes to send; large arrays are split into chunks.

cancellationToken CancellationToken

Cancels the send.

Returns

Task

A task that completes once every chunk has been sent.