Repository navigation
Does spin/fermyon cloud support SSE? #1867
Answered
by
itowlson
maxwell8888
asked this question in
Q&A
|
I'm interested in trying spin/fermyon cloud but my usecase requires server-sent events. I can't find any reference to SSE in the spin github repo or docs. Thanks. |
Answered by
itowlson
Oct 9, 2023
Replies: 1 comment 1 reply
|
It isn't possible in Spin 1.x, but it should be possible in Spin 2.x and the corresponding iteration of Fermyon Cloud. The reason is that in Spin 1.x you have to return the entire HTTP response at once, whereas in Spin 2.x you should be able to stream it. You'll then be able to use the server-side events protocol (https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#sending_events_from_the_server) to emit events as required. @dicej is working on streaming responses and can hopefully confirm or deny. |
1 reply
Answer selected by
maxwell8888
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It isn't possible in Spin 1.x, but it should be possible in Spin 2.x and the corresponding iteration of Fermyon Cloud. The reason is that in Spin 1.x you have to return the entire HTTP response at once, whereas in Spin 2.x you should be able to stream it. You'll then be able to use the server-side events protocol (https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#sending_events_from_the_server) to emit events as required.
@dicej is working on streaming responses and can hopefully confirm or deny.