- // GET /hello/warp => 200 OK with body "Hello, warp!"
- pub async fn hello(name: String, agent: String) -> Result<impl warp::Reply, warp::Rejection> {
- Ok(format!("Hello, {} from {}!", name, agent))
- }
-
- // websocat ws://127.0.0.1:3030/ws-echo
- pub async fn ws_echo_connected(websocket: warp::ws::WebSocket) {
- // echo all messages back
- let (tx, rx) = websocket.split();
- rx.forward(tx).map(|result| {
- if let Err(e) = result {
- log::warn!("websocket error: {:?}", e);
- }
- }).await;
- }
+// GET /hello/warp => 200 OK with body "Hello, warp!"
+async fn hello(name: String, agent: String) -> Result<impl warp::Reply, warp::Rejection> {
+ Ok(format!("Hello, {} from {}!", name, agent))
+}