Run HTTP server in iOS app with Swift to collect data in the basement

In my basement I have a couple of raspberry PIs that are collecting sensor data. They cannot send the data to any server because there is no signal in the basement.

So my idea was to develop an app that would host a web server so that I can take my phone, go into the basement and enable the hotspot so that the raspberrys can connect to my phones Wifi and send their sensor data via API calls to the web server that is running on the phone.

I have read about Vapor but somehow that feels like overkill for this problem.

Do you guys have any recommendations how to solve this problem or better ideas than running a web server on the iPhone (and no, extending the wifi signal into the basement is not an option here)?

Answered by DTS Engineer in 888254022

Running a web server on iOS is feasible, but it comes with significant limitation. See iOS Background Execution Limits.

I have read about Vapor but somehow that feels like overkill for this problem.

You might find Hummingbird more to your taste. There’s a link to this and lots of other resources on the Swift website.

Oh, I’d be remiss if I didn’t talk about this:

enable the hotspot

Personal Hotspot isn’t really intended for this use case. See my explanation here. You’d be better finding an old Wi-Fi access point and using it for this task. Or even better, put your accessories and your iOS device on Ethernet.

Oh, and one more thing: In this scenario it’s likely that you’ll find the various posts linked to from Extra-ordinary Networking useful.

Share and Enjoy

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

Running a web server on iOS is feasible, but it comes with significant limitation. See iOS Background Execution Limits.

I have read about Vapor but somehow that feels like overkill for this problem.

You might find Hummingbird more to your taste. There’s a link to this and lots of other resources on the Swift website.

Oh, I’d be remiss if I didn’t talk about this:

enable the hotspot

Personal Hotspot isn’t really intended for this use case. See my explanation here. You’d be better finding an old Wi-Fi access point and using it for this task. Or even better, put your accessories and your iOS device on Ethernet.

Oh, and one more thing: In this scenario it’s likely that you’ll find the various posts linked to from Extra-ordinary Networking useful.

Share and Enjoy

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

Run HTTP server in iOS app with Swift to collect data in the basement
 
 
Q