paullouisageneau / libjuice

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

Switching networking libraries after connection established? #238

Closed lolriven closed 7 months ago

lolriven commented 7 months ago

Hello, I'm writing a network based game using Valve's GameNetworkingSockets and I'm unable to establish P2P through ICE with that library on MacOS Arm64.

Would it be possible to use libjuice for establishing peer to peer connectivity than handing that connection/sockets over to another networking library? Or binding to the specific host:ip returned successfuly by the ICE in LibJuice?

Thanks!

paullouisageneau commented 7 months ago

The ICE specification requires that the library continues answering STUN requests while application traffic flows, otherwise the other side would disconnect, so it's not possible to simply hand over the ICE connection to the user.

Of course, if you don't care about ICE compatibility, it could be possible to modify the library heavily to bind the socket to the nominated remote candidate address and hand it over to another library. However, it should be easier to modify the existing library so it sends and receives through libjuice.

Why not simply use WebRTC data channels (libdatachannel is based on libjuice)? It seems to me GameNetworkingSockets mostly reinvents the wheel here.

lolriven commented 7 months ago

Thank you so much for the response and the suggestion! I’ll look into libdatachannel.