You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/blazor/fundamentals/signalr.md
+46-11Lines changed: 46 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -491,43 +491,71 @@ In the `Program` file, call <xref:Microsoft.AspNetCore.Builder.ComponentEndpoint
491
491
492
492
## Reflect the server-side connection state in the UI
493
493
494
-
When the client detects that the connection has been lost, a default UI is displayed to the user while the client attempts to reconnect. If reconnection fails, the user is provided the option to retry.
494
+
If the client detects a lost connection to the server, a default UI is displayed to the user while the client attempts to reconnect:
If reconnection succeeds, user state is often lost. Custom code can be added to any component to save and reload user state across connection failures. For more information, see <xref:blazor/state-management>.
495
523
496
524
:::moniker range=">= aspnetcore-8.0"
497
525
498
-
To customize the UI, define a single element with an `id` of `components-reconnect-modal`. The following example places the element in the `App` component.
526
+
To customize the UI, define a single element with an `id` of `components-reconnect-modal` in the `<body>` element content. The following example places the element in the `App` component.
To customize the UI, define a single element with an `id` of `components-reconnect-modal`. The following example places the element in the host page.
534
+
To customize the UI, define a single element with an `id` of `components-reconnect-modal` in the `<body>` element content. The following example places the element in the host page.
To customize the UI, define a single element with an `id` of `components-reconnect-modal`. The following example places the element in the layout page.
542
+
To customize the UI, define a single element with an `id` of `components-reconnect-modal` in the `<body>` element content. The following example places the element in the layout page.
515
543
516
544
`Pages/_Layout.cshtml`:
517
545
518
546
:::moniker-end
519
547
520
548
:::moniker range="< aspnetcore-6.0"
521
549
522
-
To customize the UI, define a single element with an `id` of `components-reconnect-modal`. The following example places the element in the host page.
550
+
To customize the UI, define a single element with an `id` of `components-reconnect-modal` in the `<body>` element content. The following example places the element in the host page.
523
551
524
552
`Pages/_Host.cshtml`:
525
553
526
554
:::moniker-end
527
555
528
556
```cshtml
529
557
<div id="components-reconnect-modal">
530
-
There was a problem with the connection!
558
+
Connection lost.<br>Attempting to reconnect...
531
559
</div>
532
560
```
533
561
@@ -557,6 +585,15 @@ Add the following CSS styles to the site's stylesheet.
0 commit comments