Function web_socket::handshake::request
source · pub fn request(
host: impl AsRef<str>,
path: impl AsRef<str>,
headers: impl IntoIterator<Item = impl Header>
) -> (String, String)Expand description
Create websocket handshake request
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
...