-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Blazor Server - Auto reconnect on mobile browsers #44700
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
Blazor Server - Auto reconnect on mobile browsers #44700
Conversation
…delay afterwards. Support for mobile browsers to enable page reload when circuit was lost
…ix/32113-blazor-serverside-reconnection
…ix/32113-blazor-serverside-reconnection
… comments Optional onCircuitRejected call if implemented
Thanks for your PR, @konradbartecki. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
@TanayParikh can you please review this? Thanks! |
Hey @konradbartecki, thanks for reaching out. At this time, I don't believe this is something we'd like to take into the framework. We have a broader undertaking with #30344 which we believe may resolve this issue at a lower level. cc/ @javiercn @SteveSandersonMS @MackinnonBuck in case you disagree with that assessment. Thanks for your time! |
I have added a new commit fixing the build and tests, since the work on it was done already anyway. Would be really great to have it in 7.0 as configurable workaround if #30344 does not get into 7.0. Testing connection rejected scenarioAssuming we continue with this PR I would need an advice on testing the following scenario that is not currently covered:
aspnetcore/src/Components/Web.JS/src/Platform/Circuits/DefaultReconnectionHandler.ts Lines 79 to 88 in 562f88c
I saw your internal app used for E2E testing and was not sure what was the best way to simulate circuit eviction, basically we should:
My best idea was to add to your Then add a using System.Reflection;
using Microsoft.AspNetCore.Components.Server.Circuits;
namespace BasicTestApp.Reconnection
{
public class ScopedCircuitContainer : CircuitHandler
{
public ScopedCircuitContainer()
{
}
private Circuit _circuit;
public override Task OnCircuitOpenedAsync(Circuit circuit, CancellationToken cancellationToken)
{
_circuit = circuit;
return base.OnCircuitOpenedAsync(circuit, cancellationToken);
}
public override Task OnCircuitClosedAsync(Circuit circuit, CancellationToken cancellationToken)
{
_circuit = circuit;
return base.OnCircuitClosedAsync(circuit, cancellationToken);
}
public void RemoveCircuitFromServer()
{
var circuitHost = _circuit
.GetType()
.GetField("_circuitHost", BindingFlags.Instance | BindingFlags.NonPublic)
.GetValue(_circuit);
var disposeMethod = circuitHost
.GetType()
.GetMethod("DisposeAsync");
disposeMethod.Invoke(circuitHost, Array.Empty<object>());
}
}
} And attach I am aware that this is nasty for using reflection, but I did not see any other way around it really and any changes to that code would be detected by a failing test.
I could cover this scenario regardless if you want to merge this branch, because I already did some research on that, so please let me know. |
Hi @konradbartecki. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |
Blazor Server - Auto reconnect on mobile browsers
Description
Rejected
prompt was displayed because circuit was already recycled on server.onConnectionRejected
eventRe-opens a PR #32122
Fixes #32113 #26985