Table of Contents

Interface IStreamingResponse

Namespace
Microsoft.Agents.Builder
Assembly
Microsoft.Agents.Builder.dll
public interface IStreamingResponse

Properties

EndStreamTimeout

The time in milliseconds that EndStream or Reset wait. After this period expires, the final message will be sent.

int EndStreamTimeout { get; set; }

Property Value

int

FinalMessage

Set IActivity that will be (optionally) used for the final streaming message.

IActivity FinalMessage { get; set; }

Property Value

IActivity

Interval

The interval in milliseconds at which intermediate messages are sent.

int Interval { get; set; }

Property Value

int

Remarks

Teams default: 1000 WebChat default: 500

IsStreamingChannel

Indicate if the current channel supports intermediate messages.

bool IsStreamingChannel { get; }

Property Value

bool

Remarks

Channels that don't support intermediate messages will buffer text, and send a normal final message when EndStreamAsync is called.

Message

The buffered message.

string Message { get; }

Property Value

string

Methods

EndStreamAsync(CancellationToken)

Ends the stream by sending the final message to the client.

Task EndStreamAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task

A Task representing the async operation

Remarks

Since the messages are sent on an interval, this call will block until all have been sent before sending the final Message.

IsStreamStarted()

bool IsStreamStarted()

Returns

bool

QueueInformativeUpdateAsync(string, CancellationToken)

Queues an informative update to be sent to the client.

Task QueueInformativeUpdateAsync(string text, CancellationToken cancellationToken = default)

Parameters

text string

Text of the update to send.

cancellationToken CancellationToken

Returns

Task

QueueTextChunk(string)

Queues a chunk of partial message text to be sent to the client.

void QueueTextChunk(string text)

Parameters

text string

Partial text of the message to send.

ResetAsync(CancellationToken)

Reset an already used stream. If the stream is still running, this will wait for completion.

Task ResetAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task

UpdatesSent()

Gets the number of updates sent for the stream.

int UpdatesSent()

Returns

int

Number of updates sent so far.