Update tokio-tungstenite
This commit is contained in:
parent
fe68694932
commit
bc3e3b1e13
2 changed files with 7 additions and 5 deletions
|
|
@ -17,7 +17,7 @@ serde = { version = "1.0.215", features = ["derive"] }
|
||||||
serde_json = "1.0.133"
|
serde_json = "1.0.133"
|
||||||
tokio = { version = "1.42.0", features = ["time", "sync", "macros", "rt"] }
|
tokio = { version = "1.42.0", features = ["time", "sync", "macros", "rt"] }
|
||||||
tokio-stream = "0.1.16"
|
tokio-stream = "0.1.16"
|
||||||
tokio-tungstenite = { version = "0.24.0", features = ["rustls-tls-native-roots"] }
|
tokio-tungstenite = { version = "0.26.2", features = ["rustls-tls-native-roots"] }
|
||||||
unicode-normalization = "0.1.24"
|
unicode-normalization = "0.1.24"
|
||||||
|
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
|
|
|
||||||
10
src/conn.rs
10
src/conn.rs
|
|
@ -427,7 +427,7 @@ impl Conn {
|
||||||
}
|
}
|
||||||
tungstenite::Message::Ping(_) => {}
|
tungstenite::Message::Ping(_) => {}
|
||||||
tungstenite::Message::Pong(payload) => {
|
tungstenite::Message::Pong(payload) => {
|
||||||
if self.last_ws_ping_payload == Some(payload) {
|
if self.last_ws_ping_payload == Some(payload.to_vec()) {
|
||||||
self.last_ws_ping_replied_to = true;
|
self.last_ws_ping_replied_to = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -528,7 +528,9 @@ impl Conn {
|
||||||
let ws_payload = now.as_millisecond().to_be_bytes().to_vec();
|
let ws_payload = now.as_millisecond().to_be_bytes().to_vec();
|
||||||
self.last_ws_ping_payload = Some(ws_payload.clone());
|
self.last_ws_ping_payload = Some(ws_payload.clone());
|
||||||
self.last_ws_ping_replied_to = false;
|
self.last_ws_ping_replied_to = false;
|
||||||
self.ws.send(tungstenite::Message::Ping(ws_payload)).await?;
|
self.ws
|
||||||
|
.send(tungstenite::Message::Ping(ws_payload.into()))
|
||||||
|
.await?;
|
||||||
|
|
||||||
// Send new euph ping
|
// Send new euph ping
|
||||||
let euph_payload = Time::from_timestamp(now);
|
let euph_payload = Time::from_timestamp(now);
|
||||||
|
|
@ -561,7 +563,7 @@ impl Conn {
|
||||||
.into_packet()?;
|
.into_packet()?;
|
||||||
debug!(target: "euphoxide::conn::full", "Sending {packet:?}");
|
debug!(target: "euphoxide::conn::full", "Sending {packet:?}");
|
||||||
|
|
||||||
let msg = tungstenite::Message::Text(serde_json::to_string(&packet)?);
|
let msg = tungstenite::Message::Text(serde_json::to_string(&packet)?.into());
|
||||||
self.ws.send(msg).await?;
|
self.ws.send(msg).await?;
|
||||||
|
|
||||||
let _ = reply_tx.send(self.replies.wait_for(id));
|
let _ = reply_tx.send(self.replies.wait_for(id));
|
||||||
|
|
@ -579,7 +581,7 @@ impl Conn {
|
||||||
.into_packet()?;
|
.into_packet()?;
|
||||||
debug!(target: "euphoxide::conn::full", "Sending {packet:?}");
|
debug!(target: "euphoxide::conn::full", "Sending {packet:?}");
|
||||||
|
|
||||||
let msg = tungstenite::Message::Text(serde_json::to_string(&packet)?);
|
let msg = tungstenite::Message::Text(serde_json::to_string(&packet)?.into());
|
||||||
self.ws.send(msg).await?;
|
self.ws.send(msg).await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue