79241959

Date: 2024-12-01 16:02:46
Score: 0.5
Natty:
Report link

Thanks to Brian Parker, I found my issue. If you're using WASM or InteractiveAuto, make sure to pass in the parameters as a query string and not a header. I did like this:

var url = "";
if (OperatingSystem.IsBrowser())
{
    url = string.Format("https://localhost:7000/chatHub?BusinessId={0}", businessId);
}
else
{
    url = "https://localhost:7000/chatHub";
}

HubConnection = new HubConnectionBuilder()
    .WithUrl(Navigation.ToAbsoluteUri(url), options =>
    {            
        options.Headers.Add("BusinessId", businessId.ToString());

    }).AddJsonProtocol(o =>
    {
        o.PayloadSerializerOptions.PropertyNamingPolicy = null;

    }).WithAutomaticReconnect()
    .Build();
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: GH DevOps