rustwasm / gloo

A modular toolkit for building fast, reliable Web applications and libraries with Rust and WASM
https://gloo-rs.web.app
Apache License 2.0
1.78k stars 146 forks source link

Recognise that connection handling is a developer concern #493

Closed huntc closed 1 month ago

huntc commented 1 month ago

Removes the logic to test for a connection error with Server Sent Events.

My original attraction to SSE was that the browser would handle the connection and re-connect if it can. It turns out, after many years of using SSE(!), I learn that browsers are not consistent in their reconnection policy. For a start, browsers can decide how long to wait before re-connecting.

SSE will re-connect automatically under certain conditions, but again there's no specification in terms of what these conditions should be. For example, an "503 - service unavailable" does not seem to cause a re-connect for Chrome, yet this is often a transient error.

In the end, you're left with implementing your own connection handling anyway. We therefore push the testing of the connecting state back on the developer.

I also clean up a couple of compiler/clippy warnings along the way, and fix the feature flag test for testing the net modules.

huntc commented 1 month ago

Actually, I think the existing logic is just fine having looked inside WebKit. Closing.