http_server: fix websocket stripping of processId

This commit is contained in:
bitful-pannul 2024-08-16 18:30:30 +03:00
parent 29e318c9d1
commit 2d19c65e04

View File

@ -459,18 +459,22 @@ async fn ws_handler(
drop(ws_path_bindings); drop(ws_path_bindings);
// stripping ProcessId from path
let formatted_path = format!(
"/{}",
original_path
.trim_start_matches('/')
.strip_prefix(&app.to_string())
.unwrap_or("")
.trim_start_matches('/')
);
Ok(ws_connection.on_upgrade(move |ws: WebSocket| async move { Ok(ws_connection.on_upgrade(move |ws: WebSocket| async move {
maintain_websocket( maintain_websocket(
ws, ws,
our.clone(), our.clone(),
app, app,
// remove process id from beginning of path by splitting into segments formatted_path,
// separated by "/" and taking all but the first
original_path
.split('/')
.skip(1)
.collect::<Vec<&str>>()
.join("/"),
jwt_secret_bytes.clone(), jwt_secret_bytes.clone(),
ws_senders.clone(), ws_senders.clone(),
send_to_loop.clone(), send_to_loop.clone(),