reqwasm icon indicating copy to clipboard operation
reqwasm copied to clipboard

interest in support for EventSource?

Open astraw opened this issue 3 years ago • 4 comments

Is there any interest in expanding this crate also to wrap web_sys::EventSource? I would imagine taking strong inspiration from how web_sys::WebSocket is wrapped. I am thinking about a future for what was previously done by yew-event-source in yew 0.19 and it seems this crate would be a natural home.

astraw avatar Sep 25 '21 07:09 astraw

Sounds something nice to have. I've never worked with SSE so I can't really say much about it. If an API for that were to exist, it would be something like the WebSocket one. I'm not fully sure about the error handling aspect of WebSocket API which is something I would like to address first

ranile avatar Sep 25 '21 12:09 ranile

OK, thanks. I may have a go at implementation but understand the error handling may need to be reworked. I think of SSEs more-or-less like uni-directional text-only websockets (from server to client only with no binary data). The advantage of this is that any streaming HTTP client can stream data from the server without requiring additional websocket support. SSEs should also be directly compatible with HTTP/2 and HTTP/3 with no further ado.

astraw avatar Sep 26 '21 08:09 astraw

Thanks again for the feedback. At the moment I've gotten a little example working without reqwasm but rather just using using plain web-sys. I am going to go with that approach for a while and for myself will de-prioritize the idea adding EventSource support to reqwasm. You may close the issue if you like.

astraw avatar Sep 27 '21 19:09 astraw

I will leave the issue open. SSE is something that should be supported.

ranile avatar Oct 10 '21 11:10 ranile