Skip to content

Commit 55389a4

Browse files
committed
refactor: improve the format of WS downstream URL
Signed-off-by: Xin Liu <[email protected]>
1 parent 4238f7b commit 55389a4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/handlers/websocket.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ pub async fn websocket_handler(
4141
return Err(StatusCode::SERVICE_UNAVAILABLE);
4242
}
4343

44-
// 3. Convert HTTP URL to WebSocket URL
45-
let downstream_ws_url = convert_to_ws_url(&session.downstream_server_url);
44+
// 3. Convert downstream URL to WebSocket format and append session_id to path
45+
let downstream_ws_url = format!(
46+
"{}/{}",
47+
convert_to_ws_url(&session.downstream_server_url).trim_end_matches('/'),
48+
session_id
49+
);
4650
info!("Downstream WebSocket URL: {}", downstream_ws_url);
4751

4852
// 4. Upgrade to WebSocket connection

0 commit comments

Comments
 (0)