diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 7156196d..308d907e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All changes to this project will be documented in this file. +## [9.3.0] - 2020-04-15 + +(websocket) add a positive number to the heartbeat message sent, incremented each time the heartbeat is sent + ## [9.2.9] - 2020-04-15 (ixcobra) change cobra event callback to use a struct instead of several objects, which is more flexible/extensible diff --git a/ixbots/ixbots/IXCobraToSentryBot.cpp b/ixbots/ixbots/IXCobraToSentryBot.cpp index 2e6ce0ed..3567d75b 100644 --- a/ixbots/ixbots/IXCobraToSentryBot.cpp +++ b/ixbots/ixbots/IXCobraToSentryBot.cpp @@ -237,7 +237,7 @@ namespace ix } else if (event->type == ix::CobraEventType::Pong) { - spdlog::info("Received websocket pong"); + spdlog::info("Received websocket pong: {}", event->errMsg); } else if (event->type == ix::CobraEventType::HandshakeError) { diff --git a/ixcobra/ixcobra/IXCobraConnection.cpp b/ixcobra/ixcobra/IXCobraConnection.cpp index 7446e71b..f4843687 100644 --- a/ixcobra/ixcobra/IXCobraConnection.cpp +++ b/ixcobra/ixcobra/IXCobraConnection.cpp @@ -239,7 +239,7 @@ namespace ix } else if (msg->type == ix::WebSocketMessageType::Pong) { - invokeEventCallback(ix::CobraEventType::Pong); + invokeEventCallback(ix::CobraEventType::Pong, msg->str); } }); } diff --git a/ixwebsocket/IXWebSocketTransport.cpp b/ixwebsocket/IXWebSocketTransport.cpp index 0a401d3d..45a51015 100644 --- a/ixwebsocket/IXWebSocketTransport.cpp +++ b/ixwebsocket/IXWebSocketTransport.cpp @@ -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()); } diff --git a/ixwebsocket/IXWebSocketTransport.h b/ixwebsocket/IXWebSocketTransport.h index ab278af3..09b88b6b 100644 --- a/ixwebsocket/IXWebSocketTransport.h +++ b/ixwebsocket/IXWebSocketTransport.h @@ -212,6 +212,7 @@ namespace ix static const int kDefaultPingIntervalSecs; static const std::string kPingMessage; + std::atomic _pingCount; // We record when ping are being sent so that we can know when to send the next one mutable std::mutex _lastSendPingTimePointMutex; diff --git a/ixwebsocket/IXWebSocketVersion.h b/ixwebsocket/IXWebSocketVersion.h index 7c546325..307d05da 100644 --- a/ixwebsocket/IXWebSocketVersion.h +++ b/ixwebsocket/IXWebSocketVersion.h @@ -6,4 +6,4 @@ #pragma once -#define IX_WEBSOCKET_VERSION "9.2.9" +#define IX_WEBSOCKET_VERSION "9.3.0" diff --git a/ws/ws_cobra_subscribe.cpp b/ws/ws_cobra_subscribe.cpp index c4d0f0dc..6c1d840e 100644 --- a/ws/ws_cobra_subscribe.cpp +++ b/ws/ws_cobra_subscribe.cpp @@ -164,7 +164,7 @@ namespace ix } else if (event->type == ix::CobraEventType::Pong) { - spdlog::info("Received websocket pong"); + spdlog::info("Received websocket pong: {}", event->errMsg); } else if (event->type == ix::CobraEventType::HandshakeError) {