Share via


Results.ServerSentEvents Method

Definition

Overloads

ServerSentEvents(IAsyncEnumerable<String>, String)

Produces a ServerSentEventsResult<T> response.

public static Microsoft.AspNetCore.Http.IResult ServerSentEvents(System.Collections.Generic.IAsyncEnumerable<string> values, string? eventType = default);
static member ServerSentEvents : System.Collections.Generic.IAsyncEnumerable<string> * string -> Microsoft.AspNetCore.Http.IResult
Public Shared Function ServerSentEvents (values As IAsyncEnumerable(Of String), Optional eventType As String = Nothing) As IResult

Parameters

values
IAsyncEnumerable<String>

The values to be included in the HTTP response body.

eventType
String

The event type to be included in the HTTP response body.

Returns

The created ServerSentEventsResult<T> for the response.

Remarks

Strings serialized by this result type are serialized as raw strings without any additional formatting.

Applies to

ServerSentEvents<T>(IAsyncEnumerable<SseItem<T>>)

Produces a ServerSentEventsResult<T> response.

public static Microsoft.AspNetCore.Http.IResult ServerSentEvents<T>(System.Collections.Generic.IAsyncEnumerable<System.Net.ServerSentEvents.SseItem<T>> values);
static member ServerSentEvents : System.Collections.Generic.IAsyncEnumerable<System.Net.ServerSentEvents.SseItem<'T>> -> Microsoft.AspNetCore.Http.IResult
Public Shared Function ServerSentEvents(Of T) (values As IAsyncEnumerable(Of SseItem(Of T))) As IResult

Type Parameters

T

The type of object that will be serialized to the response body.

Parameters

values
IAsyncEnumerable<SseItem<T>>

The values to be included in the HTTP response body.

Returns

The created ServerSentEventsResult<T> for the response.

Remarks

Strings serialized by this result type are serialized as raw strings without any additional formatting. Other types are serialized using the configured JSON serializer options.

Applies to

ServerSentEvents<T>(IAsyncEnumerable<T>, String)

Produces a ServerSentEventsResult<T> response.

public static Microsoft.AspNetCore.Http.IResult ServerSentEvents<T>(System.Collections.Generic.IAsyncEnumerable<T> values, string? eventType = default);
static member ServerSentEvents : System.Collections.Generic.IAsyncEnumerable<'T> * string -> Microsoft.AspNetCore.Http.IResult
Public Shared Function ServerSentEvents(Of T) (values As IAsyncEnumerable(Of T), Optional eventType As String = Nothing) As IResult

Type Parameters

T

The type of object that will be serialized to the response body.

Parameters

values
IAsyncEnumerable<T>

The values to be included in the HTTP response body.

eventType
String

The event type to be included in the HTTP response body.

Returns

The created ServerSentEventsResult<T> for the response.

Remarks

Strings serialized by this result type are serialized as raw strings without any additional formatting. Other types are serialized using the configured JSON serializer options.

Applies to