Open captainsafia opened 2 months ago
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
As of https://github.com/dotnet/runtime/pull/102238 and https://github.com/dotnet/runtime/issues/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.