1 unstable release
0.1.0 | Jun 27, 2022 |
---|
#226 in #header
121 downloads per month
5KB
80 lines
headers-client-ip
Use with axum
let app = Router::new().route("/ws", get(ws_handler));
async fn ws_handler(
ws: WebSocketUpgrade,
ip: Option<TypedHeader<XRealIP>>,
) -> impl IntoResponse {
if let Some(TypedHeader(user_ip)) = ip {
println!("`{}` connected", user_ip);
}
ws.on_upgrade(handle_socket)
}
async fn handle_socket(mut socket: WebSocket) {
//
}
Dependencies
~1.5MB
~30K SLoC