Search code examples
asp.net-coreblazor-server-side

Why does Blazor Server have the browser call blazor.server.js multiple times?


I watched a page load using F12 and blazor.server.js is loaded multiple times (see below). I understand the browser loading multiple times because of the ?id=... being different on each. But why does the Blazor code need to keep reloading the same Javascript file?

enter image description here


Solution

  • I found the type of the request is fetch, it means you are using LongPolling, not Websocket.

    So it's expected behavior for LongPolling. Here is the official doc about Long Polling and SignalR.

    When using SignalR technology, it is recommended to use the Websocket protocol.