zero4rs 2.0.0

zero4rs is a powerful, pragmatic, and extremely fast web framework for Rust
Documentation
use crate::prelude2::*;

pub mod speed_tests_ws;

// 测试网速
/// Speed tests are an excellent way to check your network connection speed.
/// Fast network connections are key for enjoying a seamless experience on the internet.
pub async fn test_page(request: HttpRequest) -> impl Responder {
    let ctx = tera::Context::new();
    request.render(200, "websocket/speed.html", ctx)
}

// WebSocket handshake and start `MyWebSocket` actor.
pub async fn ws(
    req: HttpRequest,
    stream: web::Payload,
) -> core::result::Result<HttpResponse, actix_web::Error> {
    actix_web_actors::ws::start(
        crate::websocket::speed_tests::speed_tests_ws::MyWebSocket::new(),
        &req,
        stream,
    )
}