snapview / tokio-tungstenite

Future-based Tungstenite for Tokio. Lightweight stream-based WebSocket implementation
MIT License
1.88k stars 236 forks source link

Passing body in `connect`? #315

Closed Latawiec closed 11 months ago

Latawiec commented 11 months ago

I wanted to use this crate to test my server implementation. Server path upgrading the connection to WS also requires a json-formatted body to configure what the connection is actually meant to do. Based on this config I can also reject the upgrade.

I checked tungstenite and websocket crates and neither seem to support sending body along with upgrade request.

Am I missing something? Is it just user-error that I want to send body in GET?

agalakhov commented 11 months ago

I'm in doubt it's permitted by the standard. Is it?

Latawiec commented 11 months ago
A payload within a GET request message has no defined semantics;
sending a payload body on a GET request
might cause some existing implementations to reject the request.

Uh oh :( So I guess URL attributes is the only way.