System.Net.ServerSentEvents.SseFormatter
Provides methods for formatting server-sent events.
public static Task WriteAsync(IAsyncEnumerable<SseItem<string>> source, Stream destination, CancellationToken cancellationToken = default)
Writes the source of server-sent events to the destination stream.
public static Task WriteAsync<T>(IAsyncEnumerable<SseItem<T>> source, Stream destination, Action<SseItem<T>, IBufferWriter<byte>> itemFormatter, CancellationToken cancellationToken = default)
Writes the source of server-sent events to the destination stream.