1
0
mirror of https://github.com/actix/examples synced 2025-06-26 17:17:42 +02:00

improve actorless echo example

This commit is contained in:
Rob Ede
2022-07-12 01:08:15 +01:00
parent f3ff729a69
commit b8a1449605
7 changed files with 104 additions and 99 deletions

View File

@ -11,7 +11,7 @@ awc = "3"
derive_more = "0.99.5"
env_logger = "0.9"
futures-util = { version = "0.3.7", default-features = false, features = ["std", "sink"] }
futures-util = { version = "0.3.17", default-features = false, features = ["std", "sink"] }
log = "0.4"
rand = "0.8"
tokio = { version = "1.13.1", features = ["full"] }
tokio = { version = "1.13.1", features = ["rt", "macros", "sync", "time"] }

View File

@ -42,7 +42,8 @@ async fn chat_ws(
Ok(res)
}
#[actix_web::main]
// note that the `actix` based WebSocket handling would NOT work under `tokio::main`
#[tokio::main(flavor = "current_thread")]
async fn main() -> std::io::Result<()> {
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));

View File

@ -9,7 +9,7 @@ use std::{
};
use rand::{thread_rng, Rng as _};
use tokio::sync::{mpsc, oneshot};
use tokio::sync::mpsc;
use crate::{Command, ConnId, Msg, RoomId};