diff --git a/theia/proxy-rs/src/main.rs b/theia/proxy-rs/src/main.rs index 105adb72..d40d87be 100644 --- a/theia/proxy-rs/src/main.rs +++ b/theia/proxy-rs/src/main.rs @@ -212,7 +212,7 @@ async fn handle( let host = format!("ws://{}:{}", cluster_address, port); - ws.on_upgrade(move |socket| ws::forward(&host, ws)); + ws.on_upgrade(move |socket| ws::forward(host, socket)); (StatusCode::OK, "authorized".to_string()) } diff --git a/theia/proxy-rs/src/ws.rs b/theia/proxy-rs/src/ws.rs index 31ded65a..2f47d581 100644 --- a/theia/proxy-rs/src/ws.rs +++ b/theia/proxy-rs/src/ws.rs @@ -1,6 +1,4 @@ -use anyhow::Result; use axum::extract::ws::{CloseFrame, Message as AxumMessage, WebSocket}; -use axum::extract::WebSocketUpgrade; use futures_util::{SinkExt, StreamExt}; use tokio_tungstenite::tungstenite; use tokio_tungstenite::{connect_async, tungstenite::protocol::Message as TsMessage}; @@ -68,7 +66,7 @@ impl WebSocketMessage { } } -pub async fn forward(url: &str, client_ws: WebSocketUpgrade) { +pub async fn forward(url: String, client_ws: WebSocket) { let server_ws = match connect_async(url).await { Ok((ws, _)) => ws, Err(e) => {