[wpiutil] WebSocket: Add GetLastReceivedTime

This allows getting the timestamp that any data has been received.
This commit is contained in:
Peter Johnson
2024-01-19 21:25:13 -08:00
parent 77c09b9ce2
commit 9a5366bb83
2 changed files with 9 additions and 0 deletions

View File

@@ -418,6 +418,8 @@ static inline void Unmask(std::span<uint8_t> data,
}
void WebSocket::HandleIncoming(uv::Buffer& buf, size_t size) {
m_lastReceivedTime = m_stream.GetLoopRef().Now().count();
// ignore incoming data if we're failed or closed
if (m_state == FAILED || m_state == CLOSED) {
return;