Closed blackshadowsoftwareltd closed 1 year ago
Just return Err
from the callback instead of Ok
, and the server will refuse to connect.
Just return
Err
from the callback instead ofOk
, and the server will refuse to connect.
Just return
Err
from the callback instead ofOk
, and the server will refuse to connect.
not working if I return Err().
Err(tungstenite::Error::ConnectionClosed)
expected `[closure@event.rs:29:24]` to be a closure that returns `Result<Response<()>, Response<Option<String>>>`, but it returns `Result<_, Error>`
expected enum `Result<Response<()>, Response<Option<String>>>`
found enum `Result<_, tokio_tungstenite::tungstenite::Error>`
required for `[closure@src/events/event.rs:29:24: 29:63]` to implement
Error showing on callback in line:
let stream = tokio_tungstenite::accept_hdr_async(raw_stream, callback)
.await
.expect("Failed");
I am new in Rust. I read the example of the server-headers.rs file. but I am not understanding how can I check and validate the client-given header when a connection going to be established.
suppose I have a const header like "x". when a client wants to be connected to the server, the client must provide the "x" header. if the client does not submit this header? The server won't be connected.
Please give me some idea or any solution. Thanks