app with simultaneous access to "hot spot" network and the rest of the internet?

So I have a small homebuilt device that has a simple Arduino-like chip with wifi capabilities (to be precise, the Xiao Seeed ESP32C, for anyone who cares), and I need my iOS app to talk to this device.

Using the CoreBluetooth framework, we've had no problems --- except that in "noisy" environments sometimes we have disconnects. So we want to try wifi.

We assume that there is no public wifi network available. We'd love to do peer-to-peer networking using Network, but that's only if both devices are from Apple. They're not.

Now, the Xiao device can act as an access point, and presumably I could put my iPhone on that network and use regular TCP calls to talk to it. The problem is that my app wants to both talk to this home-built device, but ALSO make http calls to my server an amazon.

So: how do I let my iOS app talk over wifi to this simple chip, while not losing the ability to also have my app reach a general server (and receive push notifications, etc.)

To be more concrete, imagine that my app needs to be able to discover the access point provided by my device, use low-level TCP socket calls to talk to this local wifi device, all without losing the ability to also make general http calls and be just accessible to push notifications as it was before connecting to this purely local (and very short range, i.e. no more than 30 meters distant) device.

Does this make sense? Have I explained it well enough?

Answered by DTS Engineer in 813997022

I have a series of posts that should help you understand what’s going on here. You can find them hung off my Extra-ordinary Networking post. The Working with a Wi-Fi Accessory access is the obvious place to start, but the other posts explain a bunch of backstory that you’ll need.

Please review those and then post back if you have follow-up questions.

Share and Enjoy

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

I have a series of posts that should help you understand what’s going on here. You can find them hung off my Extra-ordinary Networking post. The Working with a Wi-Fi Accessory access is the obvious place to start, but the other posts explain a bunch of backstory that you’ll need.

Please review those and then post back if you have follow-up questions.

Share and Enjoy

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

As always, you are a life saver.

Thank you so much, I’ve started reading (and will continue) and one thing has almost immediately jumped out at me:

It sort of sounds like if my app connected to my wifi-accessory, which has ZERO access to the wider internet, my iPhone is quickly going to figure out “hey, this wifi network leads nowhere”.

And because of that, attempts to make HTTP calls might very well route through WWAN (I always have cellular data on in the circumstances where I connect to this device, and depend on it) and my issue is basically solved immediately?

In which case I’ll have what I want: a direct connection (via which API, I’ll have to see) to my wifi-accessory, and regular URLSession calls to my server will just continue to work (over WWAN)?

It sort of sounds like if my app connected to my wifi-accessory, which has ZERO access to the wider internet, my iPhone is quickly going to figure out “hey, this wifi network leads nowhere”.

That’s what you want, yes. However, some Wi-Fi accessories goes out out of their way to ‘lie’ about their Internet capabilities. If you’re accessory works this way, things get messy [1].

Share and Enjoy

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

[1] Unless you sit next to the accessory’s firmware developer, in which case you can poke them until they fix it. Hmmmm, that could get kinda messy too, but in a different way (-:

I'll let you know. I had actually given up hope that this would work, because I see lots of posts about people getting popups saying "You don't appear to be connected to the internet" which makes it seem like if you do hotspot to an accessory, in most cases that's your current wifi connection, and you're going to get that message.

But, if in fact, that's only for accessories that "lie" about their capabilities, maybe it's not entirely hopeless. I guess I'll do the experiment and see what transpires.

app with simultaneous access to "hot spot" network and the rest of the internet?
 
 
Q