Skip to content

Commit 78059a9

Browse files
committed
SSE return types /2
1 parent 8b46dde commit 78059a9

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

aspnetcore/fundamentals/minimal-apis/10.0-samples/MinimalServerSentEvents/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ async IAsyncEnumerable<string> GetHeartRate(
1313
while (!cancellationToken.IsCancellationRequested)
1414
{
1515
var heartRate = Random.Shared.Next(60, 100);
16-
yield return $"Hear Rate: {heartRate} bpm";
16+
yield return $"Heart Rate: {heartRate} bpm";
1717
await Task.Delay(2000, cancellationToken);
1818
}
1919
}

aspnetcore/release-notes/aspnetcore-10.0.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ This section describes new features for minimal APIs.
3939

4040
[!INCLUDE[](~/release-notes/aspnetcore-10/includes/sse.md)]
4141

42-
4342
## OpenAPI
4443

4544
This section describes new features for OpenAPI.

aspnetcore/release-notes/aspnetcore-10/includes/sse.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Server-Sent Events is a server push technology that allows a server to send a st
66

77
The [TypedResults](xref:Microsoft.AspNetCore.Http.TypedResults) class has a new static method called [ServerSentEvents](https://source.dot.net/#Microsoft.AspNetCore.Http.Results/TypedResults.cs,ceb980606eb9e295) that can be used to return a `ServerSentEvents` result. The first parameter to this method is an `IAsyncEnumerable<SseItem<T>>` that represents the stream of event messages to be sent to the client.
88

9-
The following example illustrates how to use the `TypedResults.ServerSentEvents` API to return a stream of heart rate events as JSON objects to the client:
9+
The following example illustrates how to use the `TypedResults.ServerSentEvents` API to return a stream of heart rate events as JSON objects to the client:
1010

1111
:::code language="csharp" source="~/fundamentals/minimal-apis/10.0-samples/MinimalServerSentEvents/Program.cs" id="snippet_json" :::
1212

1313
For more information, see:
1414

15-
-
16-
- [Server-Sent Events](https://developer.mozilla.org/docs/Web/API/Server-sent_events) on MDN.
17-
-
15+
- [Server-Sent Events](https://developer.mozilla.org/docs/Web/API/Server-sent_events) on MDN.
16+
- [Minimal API sample app](https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/minimal-apis/10.0-samples/MinimalServerSentEvents/Program.cs) using the `TypedResults.ServerSentEvents` API to return a stream of heart rate events as string, `ServerSentEvents`, and JSON objects to the client.
17+
- [Controller API sample app](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/web-api/action-return-types/samples/10/ControllerSSE) using the `TypedResults.ServerSentEvents` API to return a stream of heart rate events as string, `ServerSentEvents`, and JSON objects to the client.

0 commit comments

Comments
 (0)