Problem
In rs/moq-relay/src/websocket.rs, converting between axum and tungstenite WebSocket messages requires going through Vec<u8> / String, which copies the underlying Bytes buffer:
tungstenite::Message::Binary(bin) => axum::extract::ws::Message::Binary(Vec::from(bin).into()),
This is because axum bundles its own version of tungstenite internally, so the Bytes/Utf8Bytes types are incompatible even though they're structurally identical. The conversion currently allocates and copies for every message.
Cause
axum 0.8 uses tungstenite 0.24 internally, while qmux 0.0.4 exports tungstenite 0.28. The Utf8Bytes and Bytes types across these versions are not directly convertible.
Possible fixes
- Upgrade axum to a version that uses tungstenite 0.28 (when available)
- Use
unsafe transmute between identical Bytes layouts (not recommended)
- Bypass axum's WebSocket layer entirely and handle the upgrade manually with matching tungstenite version
🤖 Generated with Claude Code
Problem
In
rs/moq-relay/src/websocket.rs, converting between axum and tungstenite WebSocket messages requires going throughVec<u8>/String, which copies the underlyingBytesbuffer:This is because axum bundles its own version of tungstenite internally, so the
Bytes/Utf8Bytestypes are incompatible even though they're structurally identical. The conversion currently allocates and copies for every message.Cause
axum 0.8 uses tungstenite 0.24 internally, while qmux 0.0.4 exports tungstenite 0.28. The
Utf8BytesandBytestypes across these versions are not directly convertible.Possible fixes
unsafetransmute between identicalByteslayouts (not recommended)🤖 Generated with Claude Code