We're using an NWListener to publish a Bonjour service, and within the same app allow browsing for that service (peer-to-peer). However, when browsing, this will cause the service of the current device also to be shown. I've considered a few approaches of addressing this:
- Checking the service name, but as I understand these could potentially collide (e.g. both just called "iPhone"). Since this name is also shown in the UI, we can't just change it to a UUID or the like.
- Putting an identifier in the TXT data. However, this requires resolving the service before it is available, and IIRC just resolving every service is consider bad practice (for performance reasons).
Any suggestions would be appreciated.