Conversation
| }.ToString(); | ||
|
|
||
| hubConnection = new HubConnectionBuilder() | ||
| .WithUrl(Navigation.ToAbsoluteUri(uri)) |
There was a problem hiding this comment.
At this point it is already an absolute URI string I think. Do we need to use Navigation.ToAbsoluteUri() again? Maybe should be just .WithUrl(uri)?
There was a problem hiding this comment.
I took this directly from the PU issue, and it wasn't remarked on there.
It's a string due to the ToString, so I'm thinking this would be better as ...
var uriBuilder =
new UriBuilder(Navigation.ToAbsoluteUri("/chathub"))
{
Scheme = "http", Port = 80, Host = ipv4
};
hubConnection = new HubConnectionBuilder()
.WithUrl(uriBuilder.Uri,
config =>
{
config.UseDefaultCredentials = true;
})
.WithAutomaticReconnect()
.Build();That way, there's the UriBuilder type, which can then supply a uriBuilder.Uri to WithUrl.
Let's see if Brennan agrees with that change.
| var uri = | ||
| new UriBuilder(Navigation.ToAbsoluteUri("/chathub")) | ||
| { | ||
| Scheme = "http", Port = 80, Host = ipv4 |
There was a problem hiding this comment.
We might need a note/context explaining why a hardcoded port and "http" are set here: SignalR hub connection loops back directly to the local IIS server to bypass a load balancer/proxy and avoid the credential problem. I could see folks dropping this code in, as-is with http and Port = 80 without understanding those need to reflect their specific sitaution and why they would use this. They might assume this is a general SignalR URL config guidance as opposed to a specfic workaround.
There was a problem hiding this comment.
Perhaps, so. I'm 👂 for how deep into the scenario for the example Brennan wants to get.
There was a problem hiding this comment.
If we end up making the example more generic, we can do it this way with placeholders ...
Scheme = "{SCHEME}", Port = {PORT}, Host = ipv4|
The original issue is purely a Blazor scenario. There is a The problem was that the users' setup caused the connection from the |
|
Tomorrow morning, I'll move the coverage to the Blazor SignalR article. I'll include context in the updated section, and I'll use a more appropriate section header. |
Fixes #36119
Brennan, Wade ...
UseDefaultCredentialsbecause it's covered elsewhere in the article and not necessarily germane to the scenario (let me know if I'm incorrect about that, and I'll add it back).