websockets-rs / rust-websocket

A WebSocket (RFC6455) library written in Rust
http://websockets-rs.github.io/rust-websocket/
MIT License
1.55k stars 223 forks source link

How to get response header? #272

Open lewiszlw opened 1 year ago

lewiszlw commented 1 year ago

Hi, I'm using this crate as websocket client, I want to know how to get response header? My code like below,

let ws_client = ClientBuild:new(...)...;
let (mut ws_read, mut ws_write) = ws_client.split.unwrap();

// write loop
std::thread::spawn(move || {
    loop {
        ws_write.send_message(...);
    }
});

// read loop
std::thread::spawn(move || {
    for message in ws_read.incomming_messages() {
        // I want to get response header here.
         ...
    }
});

Or how to get response header in handshaking?