uWS::App::WebSocketBehavior<data> WebSocketBehavior;
WebSocketBehavior.open = [](uWS::WebSocket<false, true, data> *ws)
{
};
After opening a websocket, I want to perdiodically send a changing value via ws->send(). Is there some way to set a timer with a callback that can do this?
I have managed to implement this by opening another thread in .open and executing it from there, but I want to do it on the same thread as the rest of the program. I have also done it by polling for it from the client side, but I want it to be automatic.
This uses a timer and only one thread: