-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Feature request: reliable way to send SignalR messages on shutdown #13266
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
Comments
The problem seems to be that SignalR starts closing the connection as soon as ApplicationStopping fires. It might be interesting to have something like BeforeApplicationStopping that could be "blocked" with a task for users to send messages to clients. @Tratcher |
BeforeBeforeBefore* 😁 That way lies madness. Hmm, StopApplication is the very first signal from Host.StopAsync.
What if SignalR notified the app before it started closing connections? |
Compare Edit: Wait, it already does. So perhaps SignalR could simply disconnect on |
@kjkrum The problem with having SignalR wait for ApplicationStopped to disconnect is that by the point ApplicationStopped fires, the server should have already aborted every connection. AFAIK ApplicationStopping is SignalR's last chance to gracefully close its connections. Having SignalR fire its own event from its ApplicationStopping handler prior to it closing its connections like @Tratcher suggested should give SignalR app developers the hook they need to send a final message before server shutdown. |
Thanks for contacting us. |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Thanks for contacting us. |
Dupe of #25069 |
My web app runs background tasks that prevent IIS from gracefully shutting down until they complete. (This works well; code here.) The tasks poll
IApplicationLifetime.ApplicationStopping.IsCancellationRequested
in their innermost loops and try to send cancellation messages to SignalR clients when shutdown is detected. But SignalR has usually disconnected the clients before the tasks get a chance to notify them.I don't know enough about the framework to suggest a solution.
The text was updated successfully, but these errors were encountered: