From 8e69f5beb443723a79b0e0306c0c59524b2a5b2f Mon Sep 17 00:00:00 2001 From: michael1011 Date: Thu, 13 Feb 2025 14:52:18 +0100 Subject: [PATCH] refactor: include pings in WebSocket activity (#821) --- boltzr/src/api/ws/status.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boltzr/src/api/ws/status.rs b/boltzr/src/api/ws/status.rs index 51881936..5f6ad88d 100644 --- a/boltzr/src/api/ws/status.rs +++ b/boltzr/src/api/ws/status.rs @@ -228,11 +228,16 @@ 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; } }, + Message::Pong(_) => { + last_activity = Instant::now(); + }, Message::Close(_) => { break; },