websocketpp
websocketpp copied to clipboard
Heartbeat
Hello.
I need to send a "heartbeat" message every specified time after receiving a initial message. I tried stuff like std::thread but I can't keep one thread active because I have to handle other messages.
Is there any way to do this?
@zaphoyd any solutions?
Ok, I found that the server sends event like heartbeat ack after receiving the heartbeat so I decided to send heartbeat once the client goes online and after receiving that heartbeat ack but:
Sleep(interval);
c->send(hdl, heartbeat, websocketpp::frame::opcode::text);
only connects the bot but doesn't keep receiving other events because the thread is still active.
thank you for help ( :) )