svelte-adapter-azure-swa icon indicating copy to clipboard operation
svelte-adapter-azure-swa copied to clipboard

Streaming responses

Open geoffrich opened this issue 2 years ago • 6 comments

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.

geoffrich avatar Feb 17 '23 19:02 geoffrich

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.

tlaundal avatar Feb 21 '23 19:02 tlaundal

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

thomasgauvin avatar Mar 08 '23 04:03 thomasgauvin

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

dslatkin avatar Nov 08 '23 22:11 dslatkin

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 avatar Feb 28 '24 19:02 geoffrich

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 avatar Feb 28 '24 22:02 geoffrich

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

geoffrich avatar May 21 '24 19:05 geoffrich