Skip to content

Commit

Permalink
refactor: include pings in WebSocket activity
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 committed Feb 13, 2025
1 parent e76e74c commit 40b107a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions boltzr/src/api/ws/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ where
}
},
Message::Ping(payload) => {
last_activity = Instant::now();

if let Err(err) = ws_sender.send(Message::Pong(payload)).await {
trace!("Could not respond to ping: {}", err);
break;
Expand Down Expand Up @@ -301,6 +303,13 @@ where
},
}
}

if let Err(err) = ws_sender.send(Message::Close(None)).await {
trace!("Could not send close message: {}", err);
};
if let Err(err) = ws_sender.close().await {
trace!("Could not close WebSocket: {}", err);
};
}

async fn handle_message(
Expand Down

0 comments on commit 40b107a

Please sign in to comment.