auth use for websocket building

This commit is contained in:
2025-09-26 03:23:56 +02:00
parent 00c5c2bd63
commit 65146fce91
3 changed files with 4 additions and 10 deletions

View File

@@ -7,7 +7,7 @@ use axum::response::IntoResponse;
//use futures_util::stream::stream::StreamExt;
use futures_util::{StreamExt, SinkExt};
use crate::utils::db_pool::{HotelPool,AppState};
use crate::utils::{auth::AuthClaims, db_pool::{AppState, HotelPool}};
@@ -89,9 +89,10 @@ async fn handle_socket(
}
pub async fn ws_handler(
AuthClaims {user_id, hotel_id,username}: AuthClaims,
ws: WebSocketUpgrade,
State(state): State<AppState>,
Path((hotel_id, user_id)): Path<(i32, i32)>,
//Path((hotel_id, user_id)): Path<(i32, i32)>,
) -> impl IntoResponse {
ws.on_upgrade(move |socket| handle_socket(socket, state, hotel_id, user_id))
}