Handle the WebSocket upgrade request.
(
State(state): State<Arc<ServerState>>,
ws: WebSocketUpgrade,
)
| 40 | |
| 41 | /// Handle the WebSocket upgrade request. |
| 42 | async fn ws_tunnel_handler( |
| 43 | State(state): State<Arc<ServerState>>, |
| 44 | ws: WebSocketUpgrade, |
| 45 | ) -> impl IntoResponse { |
| 46 | ws.on_upgrade(move |socket| async move { |
| 47 | if let Err(e) = handle_ws_tunnel(socket, state).await { |
| 48 | warn!(error = %e, "WebSocket tunnel connection failed"); |
| 49 | } |
| 50 | }) |
| 51 | } |
| 52 | |
| 53 | /// Pipe bytes between the WebSocket and an in-memory `MultiplexService` stream. |
| 54 | async fn handle_ws_tunnel( |
nothing calls this directly
no test coverage detected