diff --git a/Common/Network/WebSocket/include/websocket.h b/Common/Network/WebSocket/include/websocket.h index af65ec4034..a88ee0309c 100644 --- a/Common/Network/WebSocket/include/websocket.h +++ b/Common/Network/WebSocket/include/websocket.h @@ -49,6 +49,7 @@ namespace NSNetwork virtual void send(const std::string& message) = 0; virtual void close() = 0; virtual void setUrl(const std::string& url) = 0; + virtual bool setReconnectInfo(const int& attemtCount, const int& delay, const int& delayMax) { return false; } virtual ~IWebSocket() {} }; diff --git a/Common/Network/WebSocket/src/socketio/socketio_internal.cpp b/Common/Network/WebSocket/src/socketio/socketio_internal.cpp index b09ac26b07..3399f375d9 100644 --- a/Common/Network/WebSocket/src/socketio/socketio_internal.cpp +++ b/Common/Network/WebSocket/src/socketio/socketio_internal.cpp @@ -64,5 +64,11 @@ namespace NSNetwork { delete m_internal; } + + bool CIOWebSocket::setReconnectInfo(const int& attemtCount, const int& delay, const int& delayMax) + { + m_internal->setReconnectInfo(attemtCount, delay, delayMax); + return true; + } } } diff --git a/Common/Network/WebSocket/src/socketio/socketio_internal.h b/Common/Network/WebSocket/src/socketio/socketio_internal.h index 2cf2616cfe..ae60308aa5 100644 --- a/Common/Network/WebSocket/src/socketio/socketio_internal.h +++ b/Common/Network/WebSocket/src/socketio/socketio_internal.h @@ -63,6 +63,7 @@ namespace NSNetwork virtual void open(const std::map& query) = 0; virtual void send(const std::string& message) = 0; virtual void close() = 0; + virtual void setReconnectInfo(const int& attemtCount, const int& delay, const int& delayMax) = 0; }; class CIOWebSocket: public CWebWorkerBase @@ -78,6 +79,7 @@ namespace NSNetwork virtual void open(const std::map& query) override; virtual void send(const std::string& message) override; virtual void close() override; + virtual bool setReconnectInfo(const int& attemtCount, const int& delay, const int& delayMax); friend class CIOWebSocket_private; friend class CIOWebSocket_private_tls; diff --git a/Common/Network/WebSocket/src/socketio/socketio_internal_private.h b/Common/Network/WebSocket/src/socketio/socketio_internal_private.h index 7c6bdc0f9e..3cd44fe1ef 100644 --- a/Common/Network/WebSocket/src/socketio/socketio_internal_private.h +++ b/Common/Network/WebSocket/src/socketio/socketio_internal_private.h @@ -230,6 +230,13 @@ namespace NSNetwork m_socket.reset(); } + + virtual void setReconnectInfo(const int& attemtCount, const int& delay, const int& delayMax) override + { + m_socket->set_reconnect_attempts(attemtCount); + m_socket->set_reconnect_delay(delay); + m_socket->set_reconnect_delay_max(delayMax); + } }; } } diff --git a/Common/Network/WebSocket/src/socketio/socketio_internal_private_no_tls.h b/Common/Network/WebSocket/src/socketio/socketio_internal_private_no_tls.h index 044f55c383..09854cbdc4 100644 --- a/Common/Network/WebSocket/src/socketio/socketio_internal_private_no_tls.h +++ b/Common/Network/WebSocket/src/socketio/socketio_internal_private_no_tls.h @@ -234,6 +234,13 @@ namespace NSNetwork m_socket.reset(); } + + virtual void setReconnectInfo(const int& attemtCount, const int& delay, const int& delayMax) override + { + m_socket->set_reconnect_attempts(attemtCount); + m_socket->set_reconnect_delay(delay); + m_socket->set_reconnect_delay_max(delayMax); + } }; } } diff --git a/Common/Network/WebSocket/websocket.pri b/Common/Network/WebSocket/websocket.pri index e9a0a0090f..aba1e7cfc7 100644 --- a/Common/Network/WebSocket/websocket.pri +++ b/Common/Network/WebSocket/websocket.pri @@ -59,7 +59,8 @@ libsocketio { _WEBSOCKETPP_CPP11_CHRONO_ \ \ "SIO_TLS=1" \ - "SIO_TLS_NO=0" + "SIO_TLS_NO=0" \ + "PING_TIMEOUT_INTERVAL=20000" include($$PWD/../../3dParty/boost/boost.pri)