mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-23 00:00:15 +02:00
Upgrade tokio-tungstenite to 0.26 (#3078)
This commit is contained in:
@@ -12,9 +12,9 @@
|
||||
|
||||
use futures_util::stream::FuturesUnordered;
|
||||
use futures_util::{SinkExt, StreamExt};
|
||||
use std::borrow::Cow;
|
||||
use std::ops::ControlFlow;
|
||||
use std::time::Instant;
|
||||
use tokio_tungstenite::tungstenite::Utf8Bytes;
|
||||
|
||||
// we will use tungstenite for websocket client impl (same library as what axum is using)
|
||||
use tokio_tungstenite::{
|
||||
@@ -65,7 +65,9 @@ async fn spawn_client(who: usize) {
|
||||
|
||||
//we can ping the server for start
|
||||
sender
|
||||
.send(Message::Ping("Hello, Server!".into()))
|
||||
.send(Message::Ping(axum::body::Bytes::from_static(
|
||||
b"Hello, Server!",
|
||||
)))
|
||||
.await
|
||||
.expect("Can not send!");
|
||||
|
||||
@@ -74,7 +76,7 @@ async fn spawn_client(who: usize) {
|
||||
for i in 1..30 {
|
||||
// In any websocket error, break loop.
|
||||
if sender
|
||||
.send(Message::Text(format!("Message number {i}...")))
|
||||
.send(Message::Text(format!("Message number {i}...").into()))
|
||||
.await
|
||||
.is_err()
|
||||
{
|
||||
@@ -90,7 +92,7 @@ async fn spawn_client(who: usize) {
|
||||
if let Err(e) = sender
|
||||
.send(Message::Close(Some(CloseFrame {
|
||||
code: CloseCode::Normal,
|
||||
reason: Cow::from("Goodbye"),
|
||||
reason: Utf8Bytes::from_static("Goodbye"),
|
||||
})))
|
||||
.await
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user