Skip to content

fix: websocket connects send configured headers and enable TLS - #73

Merged
janfeddersen-wq merged 1 commit into
janfeddersen-wq:mainfrom
acoliver:fix/streaming-ws-auth
Sep 7, 2026
Merged

janfeddersen-wq merged 1 commit into
janfeddersen-wq:mainfrom
acoliver:fix/streaming-ws-auth

Conversation

@acoliver

@acoliver acoliver commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Split from #66 per the review there: the serdes-ai-streaming fixes are independently mergeable, so they ride alone here.

What and why

  • Configured headers never reached the wire. WebSocketStream::connect accepted with_auth/with_header configuration but dropped it when building the HTTP upgrade request, so authenticated endpoints (bearer tokens, originator, account headers) silently connected unauthenticated. Headers now go out on the upgrade request.
  • The handshake had no bound. connect could hang past the configured timeout; it now honors it.
  • wss:// failed at connect time. The websocket feature did not compile TLS in, so every wss:// URL died with TLS support not compiled in. The feature now pulls rustls with native roots, matching what the workspace's reqwest already links.

Applied on top of main's tokio-tungstenite 0.21 → 0.30 bump (#70); the three-way merge was clean and both intents are preserved.

Verification

  • cargo fmt --all -- --check clean
  • cargo clippy -p serdes-ai-streaming --all-features --all-targets -- -D warnings clean
  • cargo test -p serdes-ai-streaming --all-features: 63 passed / 0 failed, including websocket::tests::configured_headers_reach_handshake_request
  • cargo check -p serdes-ai --features full passes; the changes are additive and break no workspace consumer

Fixes the transport layer that #66's codex WebSocket client depends on; the client consolidation described in that review follows separately.

WebSocketConfig::with_auth stored headers that never reached the wire: connect_async received only the URL, so authenticated endpoints rejected every handshake. Build the handshake request explicitly, apply the configured headers to it, and bound the connect with the configured timeout so a hanging endpoint fails fast instead of stalling the caller indefinitely.

The websocket feature also refused every wss:// URL with 'TLS support not compiled in' because no TLS backend was enabled behind it. TLS is part of the wss contract rather than an optional extra, so the feature now enables rustls with native root certificates. Verified against tokio-tungstenite 0.30 as upgraded on main. (janfeddersen-wq#66)
@janfeddersen-wq
janfeddersen-wq merged commit d0aae19 into janfeddersen-wq:main Sep 7, 2026
4 checks passed
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.

2 participants