How to control the flow of websocketpp ?

40 views
Skip to first unread message

feng chen

unread,
May 12, 2023, 5:20:09 PM5/12/23
to WebSocket++
At present, I use sleep method, but the effect is not very good,  Is there a better way?

leep

unread,
May 17, 2023, 6:30:16 PM5/17/23
to WebSocket++
You have the option of using m_endpoint.set_timer(300000,(bind(&type::yourFunc,this,::_1)));

yourFunc must be of the form: void yourwebsocketppObjectName::yourFunc(const websocketpp::lib::error_code &ec) having passed in const websocketpp::lib::error_code ec;
Also you may have to save hdl to an (maybe global?) object to access it in yourFunc.
Reply all
Reply to author
Forward
0 new messages