Repository navigation
webui: actually close the signaling WebSocket - #53
Merged
Merged
Conversation
#46 closed the gloo sink to end the signaling socket, but gloo-net's Sink::poll_close is a no-op and its WebSocket has no Drop, so the socket stayed open: after three takeovers each page still held four signaling sockets and the device's established :80 connections went from 2 to 10. Open the socket as a web_sys::WebSocket, keep a handle in Peer and call close() on it in Peer::close (session lost or taken over) and on every connect failure path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by 4c · project thread
Summary
Before: #46 did not stop the leak. After a session was taken over, dropped or failed to connect, the signaling WebSocket stayed open, so each Reconnect still added one more established connection on the device.
After: the signaling socket is closed when a session ends (taken over or lost) and on every failed connection attempt (send-offer error, ICE failure, data-channel timeout).
How
gloo-net's
Sink::closeis a no-op and itsWebSockethas noDrop, so #46'ssink.close()did nothing.connect()now creates the rawweb_sys::WebSocket, wraps it withWebSocket::try_fromfor the existing stream/sink code, and keeps the raw handle inPeer::signaling_ws.Peer::close()and each error path callclose()on that handle. Adds theWebSocketweb-sys feature.Testing
cargo +nightly fmt --all(CI)cargo +nightly clippy --workspace --release --all-targets -- -D warnings(CI)cargo +nightly test --workspace(CI)trunk build --lockedand wasm32 clippy incrates/rkvm-web(CI)Checklist
#[allow(...)]suppressions and no newunwrap()/expect()in production pathsMissedTickBehavior::Delayrkvm-proto🤖 Generated with Claude Code
https://claude.ai/code/session_01PbdzY6PfT28goR4BhqdsXR