refactor(ws)!: futures compat#875
Merged
George-Miao merged 27 commits intocompio-rs:masterfrom Apr 19, 2026
Merged
Conversation
be56aa1 to
e7c447b
Compare
e7c447b to
8ba414b
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors compio-ws to build on async-tungstenite instead of manually driving tungstenite, aiming to provide first-class futures Sink/Stream compatibility and simplify buffering/handshake logic across plain and TLS connections.
Changes:
- Replaces the custom
SyncStream-based WebSocket implementation (and the separate compat wrapper) with anasync_tungstenite::WebSocketStream-backedWebSocketStreamthat implementsfutures_util::Sink/Stream. - Reworks TLS helpers to wrap streams via
compio_io::compat::AsyncStreamand adds*_compatentrypoints incompio-tlsfor passing pre-configuredAsyncStreams. - Updates features/examples/tests to match the new API and removes the old
io-compatfeature path for websockets.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
compio/Cargo.toml |
Adjusts feature wiring for io-compat/tls now that compio-ws changes its compat/TLS surface. |
compio-ws/Cargo.toml |
Adds async-tungstenite, reshapes features (introduces tls), updates example gating. |
compio-ws/src/lib.rs |
Major refactor: new WebSocketStream built on async-tungstenite with Sink/Stream impls. |
compio-ws/src/tls.rs |
Updates TLS wrapping to use AsyncStream limits and new connector APIs; changes return types. |
compio-ws/tests/websocket.rs |
Updates compat test to use direct Sink/Stream behavior without the old compat wrapper. |
compio-ws/examples/ws_split.rs |
Switches split example to ws.split() on the native Sink/Stream impl. |
compio-ws/src/compat.rs |
Removes the old custom futures-compat wrapper implementation. |
compio-tls/src/maybe.rs |
Adds new_plain_compat(AsyncStream<...>) constructor. |
compio-tls/src/adapter.rs |
Adds connect_compat/accept_compat to accept pre-configured AsyncStream. |
compio-io/src/compat/async_stream.rs |
Adds AsyncStream::with_limits constructor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
George-Miao
reviewed
Apr 18, 2026
Open
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.
This PR uses
async-tungsteniteto simplify the code, and provide first-classfuturescompat.