I’m working on cross platform IoT project that requires data between devices on the same WiFi network. Initially, SwiftNIO looked ideal but there appears to be no obvious way to broadcast and listen for a Bonjour service using SwiftNIO. Have I missed any obvious solution or can anyone give any pointers as to a good approach to take?
The platforms I’m using are Linux, iOS, and MacOS. Apple's Network framework isn't supported on Linux so I ruled this out. Ideally, an approach using Swift but happy to consider other approaches.
SwiftNIO does not have support for Bonjour except when using it to drive Network.framework. There's no strong reason we couldn't, it just hasn't been implemented yet.
I've used (via GitHub - Bouke/HAP: Swift implementation of the Homekit Accessory Protocol) GitHub - Bouke/NetService: Swift NetService (Bonjour / Zeroconf / mDNS) implementation for Linux for advertising Bonjour services from a Linux host, which is working quite nicely for me.
On Linux, it uses avahi, so you'd have to have that installed and it's daemon running.
I add my voice for the needs of a standard Swift Bonjour Service Discovery solution (zero-config) that we can use on macOS, Linux and Windows.
It would be fantastic if SwiftNIO also works on Windows and if SwiftNIO supports Bonjour zero-config. Many Swift projects here expect such availability.