pub fn request(
    host: impl AsRef<str>,
    path: impl AsRef<str>,
    headers: impl IntoIterator<Item = impl FmtHeaderField>
) -> (String, String)
Expand description

Example

use web_socket::handshake::request;
let _ = request("example.com", "/path", [("key", "value")]);

Output

GET /path HTTP/1.1
Host: example.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: D3E1sFZlZfeZgNXtVHfhKg== # randomly generated
key: value
...