Skip to content

Commit

Permalink
FIX ws upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
synoet committed May 6, 2024
1 parent 81a6a02 commit 9896108
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion theia/proxy-rs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

Expand Down
4 changes: 1 addition & 3 deletions theia/proxy-rs/src/ws.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit 9896108

Please sign in to comment.