diff --git a/Cargo.lock b/Cargo.lock index 67e3a63..d314a85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -459,6 +459,7 @@ version = "0.2.14" dependencies = [ "actix-web", "futures", + "rand", "redis", "reqwest", "serde", diff --git a/Cargo.toml b/Cargo.toml index 72a18fe..4a28883 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" reqwest = { version = "0.11", features = ["json"] } futures = "0.3.28" +rand = "0.8.5" [[bin]] name = "presence" diff --git a/src/main.rs b/src/main.rs index 1dfc4b9..dcffbb0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,6 +28,8 @@ async fn connect_handler( req: HttpRequest, state: web::Data, ) -> Result { + let handler_id: u64 = rand::random(); + let token = match req.headers().get("Authorization") { Some(val) => val.to_str().unwrap_or("").split(" ").last().unwrap_or(""), None => match req.match_info().get("token") { @@ -112,7 +114,7 @@ async fn connect_handler( }); break; } else { - println!("[handler] message handled {}", message_str); + println!("[handler {}] message handled {}", handler_id, message_str); } }; }