lightyear: WASM examples broken if the user switches tabs
I think this PR broke the examples for some reason.
- the examples work fine on native
- on wasm, the connection gets timed out pretty quickly for some reason
UPDATE:
- it looks like the update is that the client tasks stop running when the page is alt-tabbed, so the connection times out if the user alttabs for too long!
- the second problem is that the server seems to be stuck in a weird state where it doesn’t accept webtransport connections anymore.
On client we get:
Failed to establish a connection to https://127.0.0.1:5000/: net::ERR_QUIC_PROTOCOL_ERROR.QUIC_NETWORK_IDLE_TIMEOUT (No recent network activity after 9003077us. Timeout:9s).
failed to connect to server: Error(JsValue(WebTransportError: Opening handshake failed.Error: Opening handshake failed.))
POSSIBLE SOLUTIONS:
- run in background thread using webworkers?
About this issue
- Original URL
- State: open
- Created 5 months ago
- Comments: 33 (13 by maintainers)
Would actually be really easy to confirm. If this behavior happens with WebSocket Transport too, then we have our culprit i think 😛
There is still a bit of latency generated by sending the data over a webworker. Working with them in rust is a pain too, so maybe making a js prototype to confirm this is a good idea first?
There are tricky sneaky ways to keep the tab alive if this is the reason btw - but none I’d recommend implementing at this crate level
Let me know if you figure out the solution; if this is something that’s better solved at the xwt level I’m interested in adding support.