Why the 1 sec delay after the websocket request?

David Thielen 2,506 Reputation points
2024-06-26T14:04:53.61+00:00

Hi all;

I have a Blazor server app running on Azure App Services. The Blazor app uses SignalR and I have it set to use web sockets.

LoadDashboard

What is going on here on the web socket request? It looks like that request is causing a 1 second delay until it then continues loading additional scripts & stylesheets.

??? - thanks - dave

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,472 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,258 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 60,201 Reputation points
    2024-06-26T15:49:26.9933333+00:00

    when your browser access the hosting page of the blazor app the following happen:

    • if pre-render supported, an instance of the Blazor app (static) is created, and the static html is generated. the Blazor app is shutdown.
    • the server return the static html which also included the bootstrap js file
    • the browser loads the hosting page html
    • the browser executes the bootstrap js
    • the bootstrap js opens a websocket on server
    • the server creates a new instance of the Blazor app (interactive). the Blazor app run init and any post render events to build the render tree (virtual dom).
    • the render tree is sent to the client over signal/r
    • the browser client code receives the render tree and uses it to update the dom. this starts the download of any external links in the render tree.

    the delay is the time it takes the new Blazor instance to init, build the render tree and download and the render tree. then the client code processing the render tree starts the other downloads.