geoffrich / svelte-adapter-azure-swa

SvelteKit adapter for Azure Static Web Apps.
MIT License
129 stars 29 forks source link

Streaming responses #114

Open geoffrich opened 1 year ago

geoffrich commented 1 year ago

An upcoming SvelteKit feature will support streaming non-essential data so pages load quicker for platforms that support it. This adapter currently does not support streaming, since the entire response is buffered before returning:

https://github.com/geoffrich/svelte-adapter-azure-swa/blob/e41f89cde57858b76df61a7ba6316f5ac0a4498d/files/entry.js#L83-L96

The effect of this is that pages will wait for the entire data response to be ready instead of showing data as soon as it is available.

I'm not sure if Azure functions support streaming, but if they do, we should update this adapter to stream responses instead of buffering them.

EDIT: this is the SvelteKit feature in question: streaming promises.

tlaundal commented 1 year ago

I think this is blocked by Azure/azure-functions-host#1361.

I spun up a function just to test if it was somehow supported, but couldn't find a way to return a stream.

thomasgauvin commented 1 year ago

Agree with tlaundal, I think support for streaming is dependent on that so blocked for now

dslatkin commented 7 months ago

According to this comment from a Microsoft employee:

We have a lot of exciting new features in the works (top of mind is stream support)

So at least it sounds like it's being actively worked on. 🙂

geoffrich commented 4 months ago

Azure announced preview support for Node.js streams: https://techcommunity.microsoft.com/t5/apps-on-azure-blog/azure-functions-support-for-http-streams-in-node-js-is-now-in/ba-p/4066575

geoffrich commented 4 months ago

Putting "help wanted" on this, in case someone wants to try updating the adapter themselves. I'll get to it eventually but not sure when I'll have time.

geoffrich commented 1 month ago

Now GA on Azure Node Functions: https://techcommunity.microsoft.com/t5/apps-on-azure-blog/azure-functions-support-for-http-streams-in-node-js-is-generally/ba-p/4140209