Update rust_socketio path in Cargo.toml and refactor ws_main function

This commit is contained in:
shenjack 2023-12-12 22:09:28 +08:00
parent 9e5a2c726c
commit 0116dbea32
Signed by: shenjack
GPG Key ID: 7B1134A979775551
2 changed files with 5 additions and 4 deletions

View File

@ -13,4 +13,4 @@ rust_socketio = "0.4.4"
serde_json = "1.0.108"
[patch.crates-io]
rust_socketio = { path = "V:/githubs/rust-socketio/socketio" }
rust_socketio = { path = "../../../rust-socketio/socketio" }

View File

@ -48,9 +48,10 @@ fn ws_main() {
let connect_call_back = |payload: Payload, _client: RawClient, _id| {
match payload {
Payload::Text(values) => {
if values.first() == Some(&Value::String("authSucceed".to_string())) {
// 一个绿色的 "已经连接到 icalingua 服务器"
println!("\x1b[32m已经登录到 icalingua!\x1b[0m");
if let Some(value) = values.first() {
if let Some("authSucceed") = value.as_str() {
println!("\x1b[32m已经登录到 icalingua!\x1b[0m");
}
}
},
_ => ()