Share via


SseFormatter.WriteAsync Method

Definition

Overloads

WriteAsync(IAsyncEnumerable<SseItem<String>>, Stream, CancellationToken)

Writes the source of server-sent events to the destination stream.

WriteAsync<T>(IAsyncEnumerable<SseItem<T>>, Stream, Action<SseItem<T>,IBufferWriter<Byte>>, CancellationToken)

Writes the source of server-sent events to the destination stream.

WriteAsync(IAsyncEnumerable<SseItem<String>>, Stream, CancellationToken)

Source:
SseFormatter.cs
Source:
SseFormatter.cs

Writes the source of server-sent events to the destination stream.

public static System.Threading.Tasks.Task WriteAsync(System.Collections.Generic.IAsyncEnumerable<System.Net.ServerSentEvents.SseItem<string>> source, System.IO.Stream destination, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsync : System.Collections.Generic.IAsyncEnumerable<System.Net.ServerSentEvents.SseItem<string>> * System.IO.Stream * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Shared Function WriteAsync (source As IAsyncEnumerable(Of SseItem(Of String)), destination As Stream, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

source
IAsyncEnumerable<SseItem<String>>

The events to write to the stream.

destination
Stream

The destination stream to write the events.

cancellationToken
CancellationToken

The CancellationToken that can be used to cancel the write operation.

Returns

A task that represents the asynchronous write operation.

Applies to

WriteAsync<T>(IAsyncEnumerable<SseItem<T>>, Stream, Action<SseItem<T>,IBufferWriter<Byte>>, CancellationToken)

Source:
SseFormatter.cs
Source:
SseFormatter.cs

Writes the source of server-sent events to the destination stream.

public static System.Threading.Tasks.Task WriteAsync<T>(System.Collections.Generic.IAsyncEnumerable<System.Net.ServerSentEvents.SseItem<T>> source, System.IO.Stream destination, Action<System.Net.ServerSentEvents.SseItem<T>,System.Buffers.IBufferWriter<byte>> itemFormatter, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsync : System.Collections.Generic.IAsyncEnumerable<System.Net.ServerSentEvents.SseItem<'T>> * System.IO.Stream * Action<System.Net.ServerSentEvents.SseItem<'T>, System.Buffers.IBufferWriter<byte>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Shared Function WriteAsync(Of T) (source As IAsyncEnumerable(Of SseItem(Of T)), destination As Stream, itemFormatter As Action(Of SseItem(Of T), IBufferWriter(Of Byte)), Optional cancellationToken As CancellationToken = Nothing) As Task

Type Parameters

T

The data type of the event.

Parameters

source
IAsyncEnumerable<SseItem<T>>

The events to write to the stream.

destination
Stream

The destination stream to write the events.

itemFormatter
Action<SseItem<T>,IBufferWriter<Byte>>

The formatter for the data field of given event.

cancellationToken
CancellationToken

The CancellationToken that can be used to cancel the write operation.

Returns

A task that represents the asynchronous write operation.

Applies to