Skip to content

Gate platform-specific tokio features for WASM compatibility#94

Open
robtfm wants to merge 1 commit into
mainfrom
feat/wasm-compat
Open

Gate platform-specific tokio features for WASM compatibility#94
robtfm wants to merge 1 commit into
mainfrom
feat/wasm-compat

Conversation

@robtfm
Copy link
Copy Markdown
Contributor

@robtfm robtfm commented Apr 13, 2026

Summary

  • Move net, io-util tokio features under the tungstenite feature flag (only needed by the tungstenite WebSocket transport's TcpListener/TcpStream)
  • Add new tokio-time feature (default-enabled) gating tokio/time and the WebSocket::ping_every default method
  • Remove rt-multi-thread and io-std from base tokio features (unused by core library)
  • Gate the convert helper under #[cfg(feature = "tungstenite")]

The core library only needs tokio rt, sync, and macros. The previous unconditional dependency on net pulled in mio and socket2, which cannot compile on wasm32-unknown-unknown. This change allows dcl-rpc to be used on WASM with a custom WebSocket backend (implementing the WebSocket trait) without the tungstenite transport.

Consumers using the tungstenite or tungstenite-native-tls features are unaffected — those features now activate the additional tokio features they need.

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant