Skip to content

Commit

Permalink
breaking: update tokio-tungstenite to 0.25 and update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
adryzz committed Dec 15, 2024
1 parent c596dea commit c0ab7a1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/websockets/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async fn ws_handler(
/// Actual websocket statemachine (one will be spawned per connection)
async fn handle_socket(mut socket: WebSocket, who: SocketAddr) {
// send a ping (unsupported by some browsers) just to kick things off and get a response
if socket.send(Message::Ping(vec![1, 2, 3])).await.is_ok() {
if socket.send(Message::Ping(vec![1, 2, 3].into())).await.is_ok() {
println!("Pinged {who}...");
} else {
println!("Could not send ping {who}!");
Expand Down Expand Up @@ -131,7 +131,7 @@ async fn handle_socket(mut socket: WebSocket, who: SocketAddr) {
// connecting to server and receiving their greetings.
for i in 1..5 {
if socket
.send(Message::Text(format!("Hi {i} times!")))
.send(Message::Text(format!("Hi {i} times!").into()))
.await
.is_err()
{
Expand All @@ -151,7 +151,7 @@ async fn handle_socket(mut socket: WebSocket, who: SocketAddr) {
for i in 0..n_msg {
// In case of any websocket error, we exit.
if sender
.send(Message::Text(format!("Server message {i} ...")))
.send(Message::Text(format!("Server message {i} ...").into()))
.await
.is_err()
{
Expand Down

0 comments on commit c0ab7a1

Please sign in to comment.