I have a web server I'm writing using Rust's Rocket framework. My tests are working just fine. However, I'm now trying to add a websocket route using rocket_ws
:
#[get("/some_route"]
async fn ws_route(ws: WebSocket) -> Channel<'static'> {
...
}
The problem is I don't know how to connect to this route during testing. My tests set up a client:
let rocket = rocket::build().manage(...).mount("/", my_routes);
let client = rocket::local::asynchronous::Client::tracked(rocket).await;
and then make requests:
let response = client.get("/foo").dispatch().await;
But what about websocket routes? It's not like I can use Tungstenite to connect because there's no actual server listening on a port.
This is currently a feature missing from rocket_ws
. There is an open ticket regarding it.