-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
[SignalR] Stateful reconnect #46691
Comments
Hey @BrennanConroy, we've seen the pull request and the proposal, we think this will be a great feature for our use-case of mobile gaming which we've been working with @kevinguo305 on. We are working on a plan to put a reference architecture to illustrate how to use signalR in gaming. @kevinguo305 - do you know if the team who built the UnityClient are aware of this work going on this feature ? |
Glad to hear it! Are you in a position to be able to try out .NET previews? We're planning on getting the initial implementation into 8.0-preview5 and would love to find folks to try it out and make sure it works well. |
Yep - we would be happy to try it out. |
@johnkattenhorn preview 5 is out.
|
This capability is too important for Blazor Server, and I hope that in the future, Blazor Server will not cause the entire program to crash due to network reasons. |
I'd love to try/test this, but for some reason .Net 8 previews still aren't supported by VS for Mac. Maybe in preview 6? |
I wanted to give my feedback and this feature. |
That's great to hear @m33p. @johnkattenhorn Have you had a chance to try it as well? As you've seen, we got the initial implementation out in preview 5 and plan to make some improvements in preview 7. I'm moving the milestone on this issue to reflect that. |
Hey @adityamandaleeka, I've asked the team if we have any feedback in this and will come back asap. |
Looking for documentation on where to implement this. Can this be placed in the program.cs? We have a dashboard business app that loses connectivity and are planning to give this a go. We are hoping to keep the project in Blazor server side. Thanks |
@m33p I assume you're using Blazor WASM and have a component using
@agrubbszenzio This isn't possible yet since Blazor server side uses the Javascript SignalR client which doesn't implement this feature yet. We're nailing down the details with the .NET client first before getting other clients updated. Javascript client will be next though. 8.0-preview6 is out today and does require the server to opt-in to this feature now to use it. Example code: app.MapHub<AppHub>("/default", o => o.AllowAcks = true); Client: var hubConnection = new HubConnectionBuilder()
.WithUrl("<hub url>",
options =>
{
options.UseAcks = true;
})
.Build(); |
This is exciting - I'd like to try it. Do we know if preview 6 will finally add VS for Mac support? |
No idea. I think the relationship is the other way around though: "Does VS for Mac support 8.0-preview6?" |
Turns out the answer is Yes! |
I'm trying this in my app, but I'm getting an error for |
Yes, it's definitely been present since preview5. This likely means you aren't actually using the preview builds. |
I was definitely using the preview builds, because I had other code using features from preview 6. However, I just uncommented that line, and it's not generating a compiler error (I haven't installed any updated SDKs since I last tried). Very very weird. But looks better now! |
I, too, am really looking forward to seeing this functionality in Blazor Server once it's been fleshed out in this context. |
Hey, is there a guaranteed way of sharing state between SignalR client and the hub? I mean guaranteed because we know HttpContext it is not. For example, I would like to receive data from the client at the OnConnected() Hub event... How could I make this? (out of using headers and cookies) Let say I have the list of connectionId s mapped with user id at in-memory dictionary or using Context.Items.. at the moment the conection get disconnected I need to map that (disconnected) connectionid to the corresponding connected new one ...(in order to identify the same device) The only way of mapping the last disconnect connectionId with the new one it to define a new hub method and call it from the client with the parameters. I am using ASP.NET Core 6. it would be useful to have more info about the SignalR conection context (not http) thanks |
Very excited about this feature, at what point after the .net 8 release will this be available when using the Azure SignalR Service? |
Is this expected before RTM, or do we need to wait on .NET 9 for that? |
This will work in 8.0-rc2 |
@BrennanConroy can we call this issue done now? |
https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-rc-2/ blazor haven't updated it yet?^_^ |
Blazor can be configured for the client side via https://learn.microsoft.com/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-7.0#configure-signalr-timeouts-and-keep-alive-on-the-client, you still need server side settings as well. |
thx |
Would this work with Azure SignalR as-is or will it require explicit support on their end? |
Azure SignalR Service requires explicit support. |
Can this work with Redis backplane and when web-api is scaled out behind load balancer? |
No, you need sticky sessions. |
How to configure the server to enable stateful reconnect with InteractiveServerRenderMode? |
|
Removing the milestone for the team to retriage |
Is there an up-to-date documentation for implementors about this feature?
|
@Benedicht I've opened #53103 to track your question about the doc. I'm going to close this issue now since it was originally meant to track getting stateful reconnect done, which has now shipped in .NET 8. Further work/issues can be tracked separately. |
Allows the server to retain the send buffer while the client is reconnecting and preserve connection state (
Context.Items
, connection ID, etc.).Thoughts:
User
?Needs work:
Try to push feature fully into SignalR layer, i.e. get new ConnectionContext from lower layer and map onto existing connectionThe text was updated successfully, but these errors were encountered: