(websocket) add a positive number to the heartbeat message sent, incremented each time the heartbeat is sent
This commit is contained in:
		| @@ -1,6 +1,10 @@ | |||||||
| # Changelog | # Changelog | ||||||
| All changes to this project will be documented in this file. | 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 | ## [9.2.9] - 2020-04-15 | ||||||
|  |  | ||||||
| (ixcobra) change cobra event callback to use a struct instead of several objects, which is more flexible/extensible | (ixcobra) change cobra event callback to use a struct instead of several objects, which is more flexible/extensible | ||||||
|   | |||||||
| @@ -237,7 +237,7 @@ namespace ix | |||||||
|             } |             } | ||||||
|             else if (event->type == ix::CobraEventType::Pong) |             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) |             else if (event->type == ix::CobraEventType::HandshakeError) | ||||||
|             { |             { | ||||||
|   | |||||||
| @@ -239,7 +239,7 @@ namespace ix | |||||||
|                 } |                 } | ||||||
|                 else if (msg->type == ix::WebSocketMessageType::Pong) |                 else if (msg->type == ix::WebSocketMessageType::Pong) | ||||||
|                 { |                 { | ||||||
|                     invokeEventCallback(ix::CobraEventType::Pong); |                     invokeEventCallback(ix::CobraEventType::Pong, msg->str); | ||||||
|                 } |                 } | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -74,6 +74,7 @@ namespace ix | |||||||
|         , _enablePong(kDefaultEnablePong) |         , _enablePong(kDefaultEnablePong) | ||||||
|         , _pingIntervalSecs(kDefaultPingIntervalSecs) |         , _pingIntervalSecs(kDefaultPingIntervalSecs) | ||||||
|         , _pongReceived(false) |         , _pongReceived(false) | ||||||
|  |         , _pingCount(0) | ||||||
|         , _lastSendPingTimePoint(std::chrono::steady_clock::now()) |         , _lastSendPingTimePoint(std::chrono::steady_clock::now()) | ||||||
|     { |     { | ||||||
|         _readbuf.resize(kChunkSize); |         _readbuf.resize(kChunkSize); | ||||||
| @@ -221,7 +222,7 @@ namespace ix | |||||||
|     { |     { | ||||||
|         _pongReceived = false; |         _pongReceived = false; | ||||||
|         std::stringstream ss; |         std::stringstream ss; | ||||||
|         ss << kPingMessage << "::" << _pingIntervalSecs << "s"; |         ss << kPingMessage << "::" << _pingIntervalSecs << "s" << "::" << _pingCount++; | ||||||
|         return sendPing(ss.str()); |         return sendPing(ss.str()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -212,6 +212,7 @@ namespace ix | |||||||
|  |  | ||||||
|         static const int kDefaultPingIntervalSecs; |         static const int kDefaultPingIntervalSecs; | ||||||
|         static const std::string kPingMessage; |         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 |         // We record when ping are being sent so that we can know when to send the next one | ||||||
|         mutable std::mutex _lastSendPingTimePointMutex; |         mutable std::mutex _lastSendPingTimePointMutex; | ||||||
|   | |||||||
| @@ -6,4 +6,4 @@ | |||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
| #define IX_WEBSOCKET_VERSION "9.2.9" | #define IX_WEBSOCKET_VERSION "9.3.0" | ||||||
|   | |||||||
| @@ -164,7 +164,7 @@ namespace ix | |||||||
|             } |             } | ||||||
|             else if (event->type == ix::CobraEventType::Pong) |             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) |             else if (event->type == ix::CobraEventType::HandshakeError) | ||||||
|             { |             { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user