Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional Documentation of IntoClientRequest on connect_async #342

Merged
merged 4 commits into from
Aug 8, 2024

Conversation

Brendan-Blanchard
Copy link
Contributor

I came across #92 when I needed this behavior for a use case of mine and wanted to save future searchers the trouble with an explicit example in the docs.

Let me know if there's anything I can change. My IDE didn't seem pleased with the formatting, even when adding the hidden async fn example() { ... } around it.

src/connect.rs Outdated
Comment on lines 23 to 32
/// let request = Request::builder()
/// .uri("wss://api.example.com")
/// .method(Method::GET)
/// .header("Sec-WebSocket-Key", "someUniqueValue")
/// .header("Sec-WebSocket-Version", "13")
/// .header("host", "api.example.com")
/// .header("Connection", "Upgrade")
/// .header("Upgrade", "websocket")
/// .body(())
/// .unwrap();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this kind of pattern is actually a bit problematic as it requires specifying all WebSocket headers properly. A more typical issue that people experience is that they just want to add one or more additional headers on top of what we generate automatically, see snapview/tungstenite-rs#327

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's even better for my use case, too. I've updated the example if you're okay with adding it. Thanks!

@daniel-abramov daniel-abramov merged commit 94a35a0 into snapview:master Aug 8, 2024
5 checks passed
zitsen added a commit to taosdata/tokio-tungstenite that referenced this pull request Sep 9, 2024
* master:
  deps: update `rustls-native-certs` to 0.8 (snapview#348)
  Additional Documentation of `IntoClientRequest` on `connect_async` (snapview#342)
  Prepare 0.23.1 release
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.

3 participants