Welcome to the Linux Foundation Forum!

LFW212 CHAP 4 STREAMING WEB CONTENT is not working in my case

Hello!

I am working on streaming data with Fastify, and I have implemented the following code. However, when I execute it, all the data is collected first before being streamed to the browser. I was expecting the data to be streamed incrementally as demonstrated in Chapter 4: Serving Web Content, Part: Streaming Content with Fastify. Could you please help me understand why the data is not being streamed progressively to the browser? What might be the issue with my implementation?

Thank you for your guidance.

Comments

  • xdxmxc
    xdxmxc Posts: 157

    @borelkoumo it could be that an optimization is being applied where a trade off is made to to buffer the content - you could pipe passThrough to reply.raw - that would eliminate any Fastify layers. Then if it still doesn't write incrementally it'll have to be something the client is doing. In that case, if you make a node client that receives the response stream you'd be able to verify for sure.

Categories

Upcoming Training