From 2d2307787eb73710387ecafe7248b136d8a171e4 Mon Sep 17 00:00:00 2001 From: Daniel Abramov Date: Sun, 15 Dec 2024 12:44:19 +0100 Subject: [PATCH] Update to new `tungstenite` and bump version --- CHANGELOG.md | 4 ++++ Cargo.toml | 6 +++--- examples/autobahn-client.rs | 2 +- examples/client.rs | 2 +- examples/interval-server.rs | 2 +- tests/communication.rs | 4 ++-- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f27899c4..fe41cbb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.25.0 + +- Update `tungstenite` to `0.25.0` ([important updates!](https://github.com/snapview/tungstenite-rs/blob/master/CHANGELOG.md#0250)). + # 0.24.0 - Update dependencies (TLS, tungstenite). diff --git a/Cargo.toml b/Cargo.toml index 180a75a6..db17e962 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,9 +6,9 @@ keywords = ["websocket", "io", "web"] authors = ["Daniel Abramov ", "Alexey Galakhov "] license = "MIT" homepage = "https://github.com/snapview/tokio-tungstenite" -documentation = "https://docs.rs/tokio-tungstenite/0.24.0" +documentation = "https://docs.rs/tokio-tungstenite/0.25.0" repository = "https://github.com/snapview/tokio-tungstenite" -version = "0.24.0" +version = "0.25.0" edition = "2018" rust-version = "1.63" include = ["examples/**/*", "src/**/*", "LICENSE", "README.md", "CHANGELOG.md"] @@ -34,7 +34,7 @@ futures-util = { version = "0.3.28", default-features = false, features = ["sink tokio = { version = "1.0.0", default-features = false, features = ["io-util"] } [dependencies.tungstenite] -version = "0.24.0" +version = "0.25.0" default-features = false [dependencies.native-tls-crate] diff --git a/examples/autobahn-client.rs b/examples/autobahn-client.rs index 7c87c170..6cc03e40 100644 --- a/examples/autobahn-client.rs +++ b/examples/autobahn-client.rs @@ -11,7 +11,7 @@ async fn get_case_count() -> Result { let (mut socket, _) = connect_async("ws://localhost:9001/getCaseCount").await?; let msg = socket.next().await.expect("Can't fetch case count")?; socket.close(None).await?; - Ok(msg.into_text()?.parse::().expect("Can't parse case count")) + Ok(msg.to_text()?.parse::().expect("Can't parse case count")) } async fn update_reports() -> Result<()> { diff --git a/examples/client.rs b/examples/client.rs index 05a73757..a4a64376 100644 --- a/examples/client.rs +++ b/examples/client.rs @@ -33,7 +33,7 @@ async fn main() { let ws_to_stdout = { read.for_each(|message| async { let data = message.unwrap().into_data(); - tokio::io::stdout().write_all(&data).await.unwrap(); + tokio::io::stdout().write_all(&data.as_slice()).await.unwrap(); }) }; diff --git a/examples/interval-server.rs b/examples/interval-server.rs index d175f2e7..efb58134 100644 --- a/examples/interval-server.rs +++ b/examples/interval-server.rs @@ -40,7 +40,7 @@ async fn handle_connection(peer: SocketAddr, stream: TcpStream) -> Result<()> { } } _ = interval.tick() => { - ws_sender.send(Message::Text("tick".to_owned())).await?; + ws_sender.send(Message::text("tick")).await?; } } } diff --git a/tests/communication.rs b/tests/communication.rs index 1196a228..a7b87954 100644 --- a/tests/communication.rs +++ b/tests/communication.rs @@ -55,7 +55,7 @@ async fn communication() { for i in 1..10 { info!("Sending message"); - stream.send(Message::Text(format!("{}", i))).await.expect("Failed to send message"); + stream.send(Message::text(format!("{}", i))).await.expect("Failed to send message"); } stream.close(None).await.expect("Failed to close"); @@ -95,7 +95,7 @@ async fn split_communication() { for i in 1..10 { info!("Sending message"); - tx.send(Message::Text(format!("{}", i))).await.expect("Failed to send message"); + tx.send(Message::text(format!("{}", i))).await.expect("Failed to send message"); } tx.close().await.expect("Failed to close");