You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Question] How to emit heartbeat/comments with Results.ServerSentEvents in .NET 10? #65103
We are migrating our application from .NET 9 to .NET 10 and since we have many SSE endpoints and we are testing the new Results.ServerSentEvents implementation with IAsyncEnumerable<T>.
Our infrastructure uses Nginx as a reverse proxy, which requires a periodic heartbeat (SSE comment lines starting with :) to prevent connection closure due to idle timeouts.
In our previous implementation, we were directly writing into the response buffer of HttpContext so we could manually mix data events and heartbeats into the stream.
With Results.ServerSentEvents handling the IAsyncEnumerable serialization automatically, we cannot find a way to inject these heartbeat frames.
Is there a built-in configuration to enable automatic heartbeats?
If not, Do you have any suggestion on what would be the best way to achieve the same using this new API?
Hey Dude, casually browsing tickets and ran across this. Not really sure why this hasn't gotten a response. But here is how I recently implemented heartbeating.
Activity
bradleyables22 commentedon Feb 23, 2026
Hey Dude, casually browsing tickets and ran across this. Not really sure why this hasn't gotten a response. But here is how I recently implemented heartbeating.
https://github.com/bradleyables22/Heimdall/blob/master/Heimdall.Server/Endpoints/BifrostEndpoints.cs
starting at line 67