I have a hosted .net 7 Blazor WASM project, that uses a SignalR connection with the host. The communication is established, and it works. So far so good. What I have noticed, is that although a WebSocket connection is established, the communication is still using long-poll + calls. Not even SSE. This is the dev environment, with both the client and the server running on the same machine - so nothing is blocking WS. One detail: the AccessTokenProvider is set for the connection options.
Why is this? Is this somehow related to the dev env or WASM? Or is this what I should expect for the prod as well?
[Update 23-12-27]
Following @JasonPan's advice, I added client side logging. The result:
(btw: browser is Edge... not supporting SSE???)
Error expanded:
Server side log:
From what I see, the connection is not refused, only challenged . And the actual WS connection has the token requested.
This is the client code:
And server:
I have test it and haven't facing this issue. So please kindly check via steps below.
1. Check you Server side setting, if there any longpolling settings like below
2. Check your client side settings, if has some code like below
3. Check where your SignalR Server is deployed?
If you deploy IIS on Windows 10/11, the default number of websocket connections is 10, so you may experience an over-the-limit connection.
My Test Result
SignalR.razor
BrowserConsoleLogger.cs
BrowserConsoleLoggerProvider.cs
Then you can check which protocol used in browser develop tools Concole windows.