Bonjour Communication

Hello,

I am working on a project and my goal is to make a communication between multiple apple watches and single iPhone. Which means from apple watches need to send data to iPhone without internet.

Conditions
  1. Need to communicate with multiple devices at a time

  2. No internet connection available

  3. Watches are not paired with iPhone

So how can be this possible. I heard about Bonjour but the is idea is not clear. Is there any limitation foe number of devices that can connect at a time in bonjour?

Thank you.
Answered by DTS Engineer in 618257022
I don’t think there’s a way to achieve this goal. The main sticking point is this:

Watches are not paired with iPhone

If the watches were paired, you could use WatchConnectivity for this. But they’re not, so you have to use a low-level networking API. That’s not going to work for the reasons outlined by Matt in Low-Level Networking on watchOS.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer
I don’t think there’s a way to achieve this goal. The main sticking point is this:

Watches are not paired with iPhone

If the watches were paired, you could use WatchConnectivity for this. But they’re not, so you have to use a low-level networking API. That’s not going to work for the reasons outlined by Matt in Low-Level Networking on watchOS.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Thanks for your reply,

Is there any possibility to communicate through wifi router?

Is there any possibility to communicate through wifi router?

Not in general. The restriction on access to low-level networking is enforced on the watch itself, not anywhere on the network. If the router had, say, an HTTP endpoint that you could use for communication using high-level APIs (specifically, NSURLSession) but most Wi-Fi routers don’t have that sort of thing.

Hmmm, actually, that suggests one possibility: You could run an HTTP server on your iPhone and have the watches talk to it via NSURLSession. There’s two potential challenges here:
  • Ensuring that the iPhone and all the watches are on the same Wi-Fi

  • Service discovery

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Hi,

Thank you so much for you reply.

In this case all the watches are connected in same Wi-Fi. And it would be very helpful if you can elaborate the point Service discovery.

Next concern is how many devices can communicate through Wi-Fi at a time and what could be the maximum distance between devices to communicate?


it would be very helpful if you can elaborate the point service discovery.

If a client wants to connect to a server, it needs to know the address of that server. If the server is out on the wider Internet, folks usually solve this problem by hard coding a DNS name. Things are not that easy on a local network. The usual solution here is Bonjour, but that’s not going to work for you on watchOS.

Next concern is how many devices can communicate through Wi-Fi at a time and what could be the maximum distance between devices to communicate?

Neither of these questions have straightforward answers; it depends on how the Wi-Fi is set up, the specifics of the APs and the STAs (see my Wi-Fi Fundamentals for an explanation of the terms I use), the specifics of the protocol, and so on.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Hi,

Thank you so much.
Bonjour Communication
 
 
Q