-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Improve Blazor reconnection experience. #13015
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
Conversation
logger.log(LogLevel.Information, 'Reconnection attempt failed. Unable to connect to the server.'); | ||
return false; | ||
} | ||
|
||
if (!(await circuit.reconnect(reconnection))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SignalR throws if you attempt to reconnect like this while the connection is not connected. This prevented the reconnect display from properly handling scenarios where the server went away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, can't remove this entirely. It breaks the expectation of calling code, i.e. in DefaultReconnectionHandler
it expects:
// reconnectCallback will asynchronously return:
// - true to mean success
// - false to mean we reached the server, but it rejected the connection (e.g., unknown circuit ID)
// - exception to mean we didn't reach the server (this can be sync or async)
In a way it makes sense. Basically, we need to have 3 different return values and instead of having an enum the previous design utilized exceptions. I'll revert this change in my next change for this experience but enable the reconnect display to handle exceptions so the UI doesn't die.
f2eb0d2
to
d1f5dcf
Compare
What's the problem with this precisely? We know that |
I think these changes look good. We should talk more about how to solve the problem with |
Oops didn't see that you had responded to this. Yes, here's what I think would be a good alternative: #12442 (comment) |
- Updated text of reconnect dialog to be more clear. - Added user feedback to the `Retry` event button click. The current flow is `Attempting to reconnect` -> `Failed to reconnect ... [Retry]` -> Click Retry -> `Attempting to reconnect`. - Found that in cases where the server went away entirely the reconnect event would through unexpectedly preventing the reconnect display from handling a failed reconnect. Added a separate error flow to understand when the server went away/could not start a SignalR connection to. - Could not find a great way to add tests for this scenario. Addresses #12442
d1f5dcf
to
bb3f249
Compare
Retry
event button click. The current flow isAttempting to reconnect
->Failed to reconnect ... [Retry]
-> Click Retry ->Attempting to reconnect
.This is of me stopping the server, clicking retry a few times, restarting the server, clicking retry, reloading the page.

Addresses #12442