0

I'd like to know how Blazors stream redering actually works. If I use SSR Blazor and the [StreamRendering] attribute, the HTML produced is sent down to browser in chunks. As I understand these chunks doesn't have to be sent in the order they appear in the HTML document. So my question is how do these chunks of HTML get placed at the correct place in the document? And what does these chunks looks like? I'vent been able to inspect the response in the dev tools of Edge(or Chrome). Why's that?

3
  • 1
    Did you read the docs. It's not chunks. streaming rendering initially renders the entire page quickly with placeholder content while asynchronous operations execute. After the operations are complete, the updated content is sent to the client on the same response connection and patched into the DOM. If you had an element's ID you could replace its contents with setHTML yourself Commented Sep 17 at 7:31
  • I'vent been able to inspect the response because it's not an HTML response, it's WebSocket packets. Blazor Server already uses SignalR over WebSockets to send the content to display to the browser, along with UI changes. Commented Sep 17 at 7:34
  • A StreamRendered page is not delivered over websockets, it is easily viewable in the network tab of your browser dev tools - just make sure you have a big enough delay in the page rendering to see it happen. It will deliver a complete HTML document (with placeholders as previously mentioned), then any async rendering will send additional HTML ( you will see it appear at the end of the response in the network tab ) which is used to hydrate the placeholder(s) Commented Sep 17 at 22:46

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.