added close frame

This commit is contained in:
Shiroyasha 2024-07-26 12:56:48 +03:00
parent 21ffa5c747
commit bd101fc3fa
Signed by: shiroyashik
GPG key ID: E4953D3940D7860A
2 changed files with 43 additions and 52 deletions

View file

@ -99,9 +99,10 @@ async fn handle_socket(mut socket: WebSocket, state: AppState) {
};
},
None => {
warn!("[WebSocket] Authentication error! Connection terminated!");
warn!("[WebSocket] Authentication error! Sending close with Re-auth code.");
debug!("[WebSocket] Tried to log in with {token}"); // Tried to log in with token: {token}
break;
debug!("{:?}", socket.send(Message::Close(Some(axum::extract::ws::CloseFrame { code: 4000, reason: "Re-auth".into() }))).await);
continue;
},
};
},