Update rust_socketio path in Cargo.toml and refactor ws_main function
This commit is contained in:
parent
9e5a2c726c
commit
0116dbea32
@ -13,4 +13,4 @@ rust_socketio = "0.4.4"
|
|||||||
serde_json = "1.0.108"
|
serde_json = "1.0.108"
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
rust_socketio = { path = "V:/githubs/rust-socketio/socketio" }
|
rust_socketio = { path = "../../../rust-socketio/socketio" }
|
@ -48,9 +48,10 @@ fn ws_main() {
|
|||||||
let connect_call_back = |payload: Payload, _client: RawClient, _id| {
|
let connect_call_back = |payload: Payload, _client: RawClient, _id| {
|
||||||
match payload {
|
match payload {
|
||||||
Payload::Text(values) => {
|
Payload::Text(values) => {
|
||||||
if values.first() == Some(&Value::String("authSucceed".to_string())) {
|
if let Some(value) = values.first() {
|
||||||
// 一个绿色的 "已经连接到 icalingua 服务器"
|
if let Some("authSucceed") = value.as_str() {
|
||||||
println!("\x1b[32m已经登录到 icalingua!\x1b[0m");
|
println!("\x1b[32m已经登录到 icalingua!\x1b[0m");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => ()
|
_ => ()
|
||||||
|
Loading…
Reference in New Issue
Block a user