diff --git a/CMakeLists.txt b/CMakeLists.txt index be7c81b..688d213 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,6 +174,8 @@ set(XEUS_ZMQ_SOURCES ${XEUS_ZMQ_SOURCE_DIR}/xdealer_channel.cpp ${XEUS_ZMQ_SOURCE_DIR}/xiopub_client.hpp ${XEUS_ZMQ_SOURCE_DIR}/xiopub_client.cpp + ${XEUS_ZMQ_SOURCE_DIR}/xheartbeat_client.hpp + ${XEUS_ZMQ_SOURCE_DIR}/xheartbeat_client.cpp ) # Targets and link diff --git a/src/xheartbeat_client.cpp b/src/xheartbeat_client.cpp index 96e365b..99de003 100644 --- a/src/xheartbeat_client.cpp +++ b/src/xheartbeat_client.cpp @@ -27,4 +27,21 @@ namespace xeus xheartbeat_client::~xheartbeat_client() { } + + void xheartbeat_client::send_heartbeat_message() + { + zmq::message_t ping_msg("ping", 4); + m_heartbeat.send(ping_msg, zmq::send_flags::none); + } + + void xheartbeat_client::run() + { + bool stop = false; + while(!stop) + { + send_heartbeat_message(); + // TODO + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + } } \ No newline at end of file diff --git a/src/xheartbeat_client.hpp b/src/xheartbeat_client.hpp index e8cb023..aadd410 100644 --- a/src/xheartbeat_client.hpp +++ b/src/xheartbeat_client.hpp @@ -30,7 +30,9 @@ namespace xeus void run(); private: - zmq::socket_t m_iopub; + void send_heartbeat_message(); + + zmq::socket_t m_heartbeat; zmq::socket_t m_controller; xclient_zmq_impl* p_client_impl;