Skip to content

Commit

Permalink
apply fix for persistent sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
“Giems” committed Feb 15, 2024
1 parent aed26c6 commit 68aa051
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions server/src/ws/app_handler/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use super::methods::{
disconnect_session::disconnect_session, initialize_session::initialize_session_connection,
};
use crate::{
state::{ClientSockets, ClientToSessions, SendToClient, SessionToAppMap, Sessions},
state::{
ClientSockets, ClientToSessions, SendToClient, SessionToApp, SessionToAppMap, Sessions,
},
structs::{
app_messages::app_messages::AppToServer,
client_messages::{client_messages::ServerToClient, new_payload_event::NewPayloadEvent},
Expand Down Expand Up @@ -81,7 +83,16 @@ pub async fn app_handler(
match app_msg {
AppToServer::InitializeRequest(init_data) => {
// TEMP FIX
let app_id = uuid7::uuid7().to_string();
let app_id = match &init_data.persistent_session_id {
Some(session_id) => session_to_app_map
.get_app_id(&session_id)
.await
.unwrap_or_else(|| {
warn!("No app_id found for session: {}", session_id);
uuid7::uuid7().to_string()
}),
None => uuid7::uuid7().to_string(),
};

let session_id = initialize_session_connection(
&app_id,
Expand Down

0 comments on commit 68aa051

Please sign in to comment.