Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for emitting ServerSentEvents from minimal APIs #56172

Open
captainsafia opened this issue Jun 10, 2024 · 1 comment
Open

Add support for emitting ServerSentEvents from minimal APIs #56172

captainsafia opened this issue Jun 10, 2024 · 1 comment
Assignees
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
Milestone

Comments

@captainsafia
Copy link
Member

As of dotnet/runtime#102238 and dotnet/runtime#98105, .NET exposes a set of types for working with server-sent events. We want to extend on these APIs in minimal APIs by provide IResult implementations for emitting SSEs to the response.

@captainsafia captainsafia added the area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc label Jun 10, 2024
@captainsafia captainsafia added this to the 9.0.0 milestone Jun 10, 2024
@captainsafia captainsafia self-assigned this Jun 10, 2024
@BrennanConroy
Copy link
Member

FYI; SSE in firefox has had a long standing bug where EventSource in Javascript doesn't fire the Open event until the server has started sending data.
See https://source.dot.net/#Microsoft.AspNetCore.Http.Connections/Internal/Transports/ServerSentEventsServerTransport.cs,45 for what we do in SignalR. It might not be relevant to Minimal since when we return the SSE IResult we'll be writing SSE frames at that point? Unless we want bi-directional SSE in which case we'd somehow need to send a comment frame when app code wants to read SSE data.

We can also steal (share) the writing side of SSE from SignalR https://source.dot.net/#Microsoft.AspNetCore.Http.Connections/ServerSentEventsMessageFormatter.cs,c4a21cef091f2b21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
Projects
None yet
Development

No branches or pull requests

2 participants