svelte-adapter-azure-swa
svelte-adapter-azure-swa copied to clipboard
Streaming responses
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.
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.
Agree with tlaundal, I think support for streaming is dependent on that so blocked for now
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. 🙂
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
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.
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