auth use for websocket building
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user