Server Sent Events from functions?

1,126 views
Skip to first unread message

Hal Heisler

unread,
Aug 1, 2022, 1:03:47 PM8/1/22
to Firebase Google Group
Hi readers, I'm new here.

I have an api function implemented in nuxt3.  It should send 10 SSE data events spaced one second apart.

When I run locally with emulator It works as expected.

When I call the function via the deployed endpoint, it takes 10 seconds for the response to arrive. I have a repo to demonstrate this. Additional notes in the Readme there.

repo:  https://github.com/sig9/nuxt-app-sse/tree/firebase
deployment URL: https://testdeleteme-7a825.web.app/api/sse/demo

Firebase is very new to me, would appreciate any tips on if this can work or if there are limitations to streaming responses with SSE. 


Michael Bleigh

unread,
Aug 1, 2022, 2:14:59 PM8/1/22
to Firebase Google Group
Firebase Hosting does not currently support streaming responses (e.g. server-sent events, websockets) in rewrites to Cloud Functions / Cloud Run. The entire response is buffered and cached in the CDN layer.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/e948c12f-1af0-4b8f-9c6b-d12bb79508b1n%40googlegroups.com.

Hal Heisler

unread,
Aug 1, 2022, 6:14:55 PM8/1/22
to Firebase Google Group
Well that's too bad. Would be cool if the firebase  hosting emulator had the same behaviour as production WRT streaming. Could save a dev a few iterations. 

Will continue my search for the best way to host a nuxt3 app with some server-sent event functions. I might need to look away from serverless frameworks. So far firebase hosting and azure node functions have streaming limitations.

BTW, this being my first look at firebase hosting, I love the response headers. Great info there.

Thanks- Hal
Reply all
Reply to author
Forward
0 new messages