(websocket) add a positive number to the heartbeat message sent, incremented each time the heartbeat is sent

This commit is contained in:
Benjamin Sergeant
2020-04-15 18:33:36 -07:00
parent 85f6b1e0b7
commit 9b8cfa0a37
7 changed files with 11 additions and 5 deletions

View File

@ -74,6 +74,7 @@ namespace ix
, _enablePong(kDefaultEnablePong)
, _pingIntervalSecs(kDefaultPingIntervalSecs)
, _pongReceived(false)
, _pingCount(0)
, _lastSendPingTimePoint(std::chrono::steady_clock::now())
{
_readbuf.resize(kChunkSize);
@ -221,7 +222,7 @@ namespace ix
{
_pongReceived = false;
std::stringstream ss;
ss << kPingMessage << "::" << _pingIntervalSecs << "s";
ss << kPingMessage << "::" << _pingIntervalSecs << "s" << "::" << _pingCount++;
return sendPing(ss.str());
}

View File

@ -212,6 +212,7 @@ namespace ix
static const int kDefaultPingIntervalSecs;
static const std::string kPingMessage;
std::atomic<uint64_t> _pingCount;
// We record when ping are being sent so that we can know when to send the next one
mutable std::mutex _lastSendPingTimePointMutex;

View File

@ -6,4 +6,4 @@
#pragma once
#define IX_WEBSOCKET_VERSION "9.2.9"
#define IX_WEBSOCKET_VERSION "9.3.0"