Table of Contents

Class TextStreamWriter

Namespace
LiveKit.Rtc
Assembly
LivekitRtc.dll

Writer for text data streams.

public class TextStreamWriter : IAsyncDisposable, IDisposable
Inheritance
TextStreamWriter
Implements
Inherited Members

Properties

Info

Gets the stream info.

public TextStreamInfo Info { get; }

Property Value

TextStreamInfo

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(string, CancellationToken)

Writes text to the stream.

public Task WriteAsync(string text, CancellationToken cancellationToken = default)

Parameters

text string

Text to send; long texts are split into chunks on character boundaries.

cancellationToken CancellationToken

Cancels the send.

Returns

Task

A task that completes once every chunk has been sent.