If deviceA is within 50 meters of deviceB, then there will be an automatic discovery/connection. If deviceA moves outside the range to 51 meters, the connection will be lost.
If deviceA moves back within 50 meters, will there be automatic discovery/connection between them again?
The reason I ask is because another developer who has networking experience told me that I have to add a timer to the view controller and fire if off every few seconds so that discovery can keep occurring. I haven't found anything on the forums or stackoverflow that gives any examples of having to use a timer with Bonjour for discovery work. I don't know if I need to add a timer or not to rediscover devices that were once connected, got disconnected, and want to connect again.
I'm far from a Network expert and that is why I ask this question.
I strongly recommend against doing that because:I haven't found anything on the forums or stackoverflow that gives any
examples of having to use a timer with Bonjour for discovery work.
Bonjour has complex logic to prevent it from flooding the network traffic. If you start and stop discovery repeatedly, you end up fighting that logic.
Bonjour has events for both a service being added and a service being removed, so it’s architected to handle this situation. This supported won’t cover handle all cases perfectly — especially when dealing with peer-to-peer discovery — but that represents a balance between latency and network usage. That balance is one for the OS to make, not your app.
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"