paullouisageneau / libjuice

JUICE is a UDP Interactive Connectivity Establishment library
Mozilla Public License 2.0
403 stars 75 forks source link

Integrate into `asio::io_service` on C++ application #230

Open CharlesJQuarra opened 8 months ago

CharlesJQuarra commented 8 months ago

I have an existing C++ client/server application using boost::asio that relies on UDP messaging, and I want it to support broader clients through NAT setups, libjuice seems the best fit, but I'm not clear how to integrate my existing code with this, as they seem to use their own polling loop

paullouisageneau commented 7 months ago

libjuice relying its own internal polling thread is not an issue, you just need to call io_service.post(handler) in callbacks to reschedule execution on the asio event loop.

If I'm not mistaken asio::io_service is deprecated and replaced by asio::io_context, for which you should use post(io_context, handler).