vitedge
vitedge copied to clipboard
Does it support streaming html?
My use case requires rapid changing content that therefore can't be cached + also fast TTFB.
Is it possible to stream part of the html instead of sending all of it in one chunk, causing long TTFB?
@OfekA Hi there! Streaming is not supported right now. I think even the worker environment is missing certain APIs related to streaming (https://twitter.com/KentonVarda/status/1425139649681444868).
@frandiox Hi! Thanks for the reply!
I've been digging through the web and found this article - https://jross.me/server-side-rendering-vue-cloudflare-workers/
Do you think this could somehow be supported? I could even try to tinker with it myself if you think it could be merged back.
@OfekA Ah yes, I remember that article. If you have time to test it then sure, I can help with some guidance:
- The actual rendering happens in
vite-ssr
repo. - We would need to add an option to the plugin for enabling streaming, and then modify
entry-server
in vite-ssr accordingly. - I think the main challenge is making it work in development with
renderToNodeStream
and then in prod withrenderToWebStream
+ workarounds. It's also possible to rely on Node 16 native ReadableStream for development, although it's not stable yet.
Tell me if that sounds feasible.