Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it support streaming html? #59

Open
ofek-a opened this issue Sep 6, 2021 · 3 comments
Open

Does it support streaming html? #59

ofek-a opened this issue Sep 6, 2021 · 3 comments

Comments

@ofek-a
Copy link

ofek-a commented Sep 6, 2021

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?

@frandiox
Copy link
Owner

frandiox commented Sep 9, 2021

@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).

@ofek-a
Copy link
Author

ofek-a commented Sep 9, 2021

@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.

@frandiox
Copy link
Owner

frandiox commented Sep 9, 2021

@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 with renderToWebStream + 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants