Skip to content

Commit e8f7a11

Browse files
committed
Update to tungstenite 0.26
1 parent eae2efa commit e8f7a11

File tree

6 files changed

+48
-29
lines changed

6 files changed

+48
-29
lines changed

Cargo.lock.msrv

Lines changed: 41 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ default-features = false
5151
features = ["sink"]
5252

5353
[dependencies.tungstenite]
54-
version = "0.24"
54+
version = "0.26"
5555
default-features = false
5656

5757
[dependencies.async-std]
@@ -133,7 +133,7 @@ hyper-util = { version = "0.1", features = ["tokio"] }
133133
http-body-util = "0.1"
134134

135135
[dev-dependencies.tungstenite]
136-
version = "0.24"
136+
version = "0.26"
137137
features = ["url"]
138138

139139
[[example]]

examples/autobahn-client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async fn get_case_count() -> Result<u32> {
99
let msg = socket.next().await.expect("Can't fetch case count")?;
1010
socket.close(None).await?;
1111
Ok(msg
12-
.into_text()?
12+
.to_text()?
1313
.parse::<u32>()
1414
.expect("Can't parse case count"))
1515
}

examples/interval-server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async fn handle_connection(peer: SocketAddr, stream: TcpStream) -> Result<()> {
4747
};
4848
}
4949
Either::Right((_, msg_fut_continue)) => {
50-
ws_sender.send(Message::Text("tick".to_owned())).await?;
50+
ws_sender.send(Message::text("tick")).await?;
5151
msg_fut = msg_fut_continue; // Continue receiving the WebSocket message.
5252
tick_fut = interval.next(); // Wait for next tick.
5353
}

src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,10 @@ impl<S> WebSocketStream<S> {
312312
}
313313

314314
/// Close the underlying web socket
315-
pub async fn close(&mut self, msg: Option<CloseFrame<'_>>) -> Result<(), WsError>
315+
pub async fn close(&mut self, msg: Option<CloseFrame>) -> Result<(), WsError>
316316
where
317317
S: AsyncRead + AsyncWrite + Unpin,
318318
{
319-
let msg = msg.map(|msg| msg.into_owned());
320319
self.send(Message::Close(msg)).await
321320
}
322321
}

tests/communication.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async fn communication() {
5858
for i in 1..10 {
5959
info!("Sending message");
6060
stream
61-
.send(Message::Text(format!("{}", i)))
61+
.send(Message::text(format!("{}", i)))
6262
.await
6363
.expect("Failed to send message");
6464
}
@@ -104,7 +104,7 @@ async fn split_communication() {
104104

105105
for i in 1..10 {
106106
info!("Sending message");
107-
tx.send(Message::Text(format!("{}", i)))
107+
tx.send(Message::text(format!("{}", i)))
108108
.await
109109
.expect("Failed to send message");
110110
}

0 commit comments

Comments
 (0)