apple / swift-nio-transport-services

Extensions for SwiftNIO to support Apple platforms as first-class citizens.

Home Page:https://swiftpackageindex.com/apple/swift-nio-transport-services/main/documentation/niotransportservices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example for Bounjour service announcement would be useful

vvuk opened this issue · comments

I've got a swift-nio app working, and I wanted to add mDNS-based service discovery. Basically, advertise my service on the port I already have things listening on (or advertise it on a random port, doesn't really matter). I had hoped it would be just a matter of switching to NIOTSEventLoop, NIOTSListenerBootstrap etc., and then setting up a bootstrap.bind(endpoint: .service(...)), but that doesn't seem sufficient (I don't see the service getting advertised).

It would be really handy to have an example for this use case, since it's probably fairly common.

swift-nio itself does not deal with service discovery, which is intentional given its low level and focused nature. we also have https://github.com/apple/swift-service-discovery which provides the basic building blocks to build upon for such use cases, and there are several folks who implemented concrete SD systems with it on top of things like DNS.

Yeah, this is less about the discovery, and more about being able to receive a connection via a service broadcast.

It turns out it was actually as easy as I described above, I just typo'd the service name in my Info.plist declaration! :/

Great, seems like this all got addressed.