face: detect websocket connection failure using ping/pong messages.
Change-Id: I66ef6a3921a56f1bb8e49fb6fdb4fa14b6a379c7
Refs: #1903
diff --git a/daemon/face/websocket-channel.hpp b/daemon/face/websocket-channel.hpp
index 62c4940..bd5604b 100644
--- a/daemon/face/websocket-channel.hpp
+++ b/daemon/face/websocket-channel.hpp
@@ -88,8 +88,26 @@
bool
isListening() const;
+ void
+ setPingInterval(time::milliseconds interval)
+ {
+ m_pingInterval = interval;
+ }
+
+ void
+ setPongTimeout(time::milliseconds timeout);
+
private:
void
+ sendPing(websocketpp::connection_hdl hdl);
+
+ void
+ handlePong(websocketpp::connection_hdl hdl, std::string msg);
+
+ void
+ handlePongTimeout(websocketpp::connection_hdl hdl, std::string msg);
+
+ void
handleMessage(websocketpp::connection_hdl hdl, websocket::Server::message_ptr msg);
void
@@ -118,6 +136,7 @@
*/
bool m_isListening;
+ time::milliseconds m_pingInterval;
};
inline bool