From 3cb1b30ca2a7a64b3c0e7904129a7810d291767b Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Thu, 19 Dec 2024 12:32:48 -0500 Subject: [PATCH 1/5] Start Blazor circuit with custom URL --- aspnetcore/blazor/fundamentals/signalr.md | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/aspnetcore/blazor/fundamentals/signalr.md b/aspnetcore/blazor/fundamentals/signalr.md index 4644e9951b9e..5c66b2e78ebc 100644 --- a/aspnetcore/blazor/fundamentals/signalr.md +++ b/aspnetcore/blazor/fundamentals/signalr.md @@ -1452,6 +1452,33 @@ Use a to c :::moniker-end +:::moniker range=">= aspnetcore-8.0" + +## Start the SignalR circuit at a different URL + +In the `App` component (`App.razor`), change the Blazor Web App script to prevent automatically starting the app and establish the circuit URL manually. The following example uses the path `/signalr`: + + +```diff +- ++ ++ +``` + +Add the following to the `Program` file: + +```csharp +app.MapBlazorHub("/signalr"); +``` + +:::moniker-end + ## `IHttpContextAccessor`/`HttpContext` in Razor components [!INCLUDE[](~/blazor/security/includes/httpcontext.md)] From 1301cc3acbef7d291b2bee49131f167a3115af9a Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Thu, 19 Dec 2024 12:35:51 -0500 Subject: [PATCH 2/5] Updates --- aspnetcore/blazor/fundamentals/signalr.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aspnetcore/blazor/fundamentals/signalr.md b/aspnetcore/blazor/fundamentals/signalr.md index 5c66b2e78ebc..4aef20ae01ad 100644 --- a/aspnetcore/blazor/fundamentals/signalr.md +++ b/aspnetcore/blazor/fundamentals/signalr.md @@ -1456,8 +1456,12 @@ Use a to c ## Start the SignalR circuit at a different URL -In the `App` component (`App.razor`), change the Blazor Web App script to prevent automatically starting the app and establish the circuit URL manually. The following example uses the path `/signalr`: +In the `App` component (`App.razor`): +* Prevent automatically starting the app by adding `autostart="false"` to the Blazor script tag. +* Establish the circuit URL manually using `Blazor.start`. + +The following example uses the path `/signalr`: ```diff - From 2e13ce046b0427cdc1149d227e32d1c2db3353f8 Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Thu, 19 Dec 2024 12:39:29 -0500 Subject: [PATCH 3/5] Updates --- aspnetcore/blazor/fundamentals/signalr.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aspnetcore/blazor/fundamentals/signalr.md b/aspnetcore/blazor/fundamentals/signalr.md index 4aef20ae01ad..d7a785ac93c2 100644 --- a/aspnetcore/blazor/fundamentals/signalr.md +++ b/aspnetcore/blazor/fundamentals/signalr.md @@ -1456,9 +1456,9 @@ Use a to c ## Start the SignalR circuit at a different URL -In the `App` component (`App.razor`): +To start the SignalR circuit at a different URL: -* Prevent automatically starting the app by adding `autostart="false"` to the Blazor script tag. +* Prevent automatically starting the app by adding `autostart="false"` to the Blazor ` From dfe523fe3df87897ed81e86685ede837749c54f4 Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:36:58 -0500 Subject: [PATCH 5/5] Updates --- aspnetcore/blazor/fundamentals/signalr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/blazor/fundamentals/signalr.md b/aspnetcore/blazor/fundamentals/signalr.md index a04b9c350f42..df6567d61468 100644 --- a/aspnetcore/blazor/fundamentals/signalr.md +++ b/aspnetcore/blazor/fundamentals/signalr.md @@ -1470,7 +1470,7 @@ Prevent automatically starting the app by adding `autostart="false"` to the Blaz + ``` -Add the following to the `Program` file: +Add the following call with the `/signalr` path to the middleware processing pipeline in the server app's `Program` file: ```csharp app.MapBlazorHub("/signalr");