Does spin/fermyon cloud support SSE? #1867
-
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. |
Beta Was this translation helpful? Give feedback.
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. |
Beta Was this translation helpful? Give feedback.
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.