The server keeps disconnected circuits around for 3 minutes by default.
However, the client gives up trying to reconnect after just 15 seconds.
const defaultOptions: BlazorOptions = {
configureSignalR: (_) => { },
logLevel: LogLevel.Warning,
reconnectionOptions: {
maxRetries: 5,
retryIntervalMilliseconds: 3000,
dialogId: 'components-reconnect-modal',
},
This causes issues with apps running on mobile browsers as the app looses the connection when the browser is sent to the background. We should change these defaults values to something more sensible that matches the defaults on the server.
For example, we should change to one of the following options:
Any of these options ensures that the client doesn't give up before the server does.
We should consider patching this as its cheap and the current experience is bad
Additionally, we should consider including some sort of progress indicator (like the attempt number) in the UI we render while we are trying to reconnect. The current UI does not provide any progress and that leads to a bad UX experience, making users prone to close the browser or refresh the page.
We should also consider using https://developer.mozilla.org/en-US/docs/Web/API/Document/onvisibilitychange (or similar API) to attempt reconnection immediately when the tab regains focus, regardless of the update cycle.
Question: is it possible for SignalR to reconnect if server was restarted? It seems in production restart of server will result in unsuccessfull tries for reconnection, though there are messages in console like "connected to websocket", but any actions on page result in "cannot something something when not in status Connected" and circuit errors or something.
I mean maybe this can be configured or something?
Most helpful comment
We should also consider using https://developer.mozilla.org/en-US/docs/Web/API/Document/onvisibilitychange (or similar API) to attempt reconnection immediately when the tab regains focus, regardless of the update cycle.