Gate platform-specific tokio features for WASM compatibility#94
Open
robtfm wants to merge 1 commit into
Open
Conversation
Move tokio features that don't compile on wasm32-unknown-unknown behind opt-in feature flags: - `net` and `io-util` gated under `tungstenite` (only needed by the tungstenite WebSocket transport which uses TcpListener/TcpStream) - `time` gated under new `tokio-time` feature (default-enabled, needed for WebSocket::ping_every) - `rt-multi-thread` and `io-std` removed from base features entirely The core library only needs tokio `rt`, `sync`, and `macros`. This allows dcl-rpc to compile on WASM when used without the tungstenite transport backend. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
net,io-utiltokio features under thetungstenitefeature flag (only needed by the tungstenite WebSocket transport'sTcpListener/TcpStream)tokio-timefeature (default-enabled) gatingtokio/timeand theWebSocket::ping_everydefault methodrt-multi-threadandio-stdfrom base tokio features (unused by core library)converthelper under#[cfg(feature = "tungstenite")]The core library only needs tokio
rt,sync, andmacros. The previous unconditional dependency onnetpulled inmioandsocket2, which cannot compile onwasm32-unknown-unknown. This change allows dcl-rpc to be used on WASM with a custom WebSocket backend (implementing theWebSockettrait) without the tungstenite transport.Consumers using the
tungsteniteortungstenite-native-tlsfeatures are unaffected — those features now activate the additional tokio features they need.🤖 Generated with Claude Code