MCPcopy Create free account
hub / github.com/actix/examples / main

Function main

websockets/echo/src/main.rs:35–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33// the actor-based WebSocket examples REQUIRE `actix_web::main` for actor support
34#[actix_web::main]
35async fn main() -> std::io::Result<()> {
36 env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
37
38 log::info!("starting HTTP server at http://localhost:8080");
39
40 HttpServer::new(|| {
41 App::new()
42 // WebSocket UI HTML file
43 .service(web::resource("/").to(index))
44 // websocket route
45 .service(web::resource("/ws").route(web::get().to(echo_ws)))
46 // enable logger
47 .wrap(middleware::Logger::default())
48 })
49 .workers(2)
50 .bind(("127.0.0.1", 8080))?
51 .run()
52 .await
53}

Callers

nothing calls this directly

Calls 1

runMethod · 0.80

Tested by

no test coverage detected