-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebSocket back-pressure #1089
Comments
I feel like I've seen this before 😃 aka in tcp |
the data channel in WebRTC is based on SCTP which has build-in flow control (FC). Sctp has a max message size setting. Other than that, each data channel has a UPD: just checked. webrtc-rs DataChannel has a write queue, which seems to be unbounded. So what I wrote above stands. |
In this context we're interacting with the WebRTC API of the browser, not with One thing that's missing from smoldot is a change to the JS <-> Rust FFI that lets you do this back-pressure. |
JavaScript, in its splendour, doesn't provide any way whatsoever to back-pressure WebSockets.
At the moment the Smoldot Wasm node will simply keep buffering data coming from the socket, and process this data asynchronously. If it is too slow to process messages, it will simply panic on OOM.
I suppose that JS environments will actually back-pressure WebSockets if they're not given the chance to run their internal events loop. In other words, it would work if the
connection_message
function doesn't return before having fully processed the incoming message. This, however, is most likely not possible.Three possibilities to fix this:
The text was updated successfully, but these errors were encountered: