Communication between IoT device and mobile device

Hey guys, quick question here.

what is the best way for a mobile device and an IoT device to communicate over ethernet/wifi?

I am building a device (using the ESP32/Arduino IDE) and building an app using Xamarin. I need the 2 devices to communicate with each other. I need the app to send commands to control pins on the arduino/esp32 and i need the device to send status updates to the app. I have looked into trying to control using HTTP GET commands, which is buggy for me. I looked into MQTT but it seems to require a broker and I dont want a middle man in the mix (one more thing to fail). it is important that the connection between the 2 is solid and each command/update needs to have some sort of ACK. Im not looking for someone to do the work for me, just to be pointed into the right direction.

side note: I looked into a REST implementation (I am a .net developer) but that isnt available for the esp32 yet and Im not good enough in c/c++ to implement it myself.

http is the easiest

Unless your project is designed to only work within a single local network (such as your house or office) then its likely you will need to rely on some kind of middle-man to facilitate network communication through your router.

A quick google reveals this ESP8266 REST library although I've not used it.

Thanks, I do expect it to only work within a single LAN. as a matter of fact, BLE may be another transport protocol that may work.

the REST library you linked is the one I was referring to. I have a request in for ESP32 support, but that may be a ways off, and may not be the best option.

You can use AJAX, and web socket as well.

I may have misunderstood what…

Unless your project is designed to only work within a single local network (such as your house or office) then its likely you will need to rely on some kind of middle-man to facilitate network communication through your router.

… was addressing. But if that was addressing what I THINK it was addressing, people wanting to know “where to I find the middle-man” need to Google “Dynamic DNS”. It isn’t hard, really… but it is one of those things that are hard to debug. Get everyting right: It works. One typo in any of several places… and it doesn’t.

===
PS- apologies… I hadn’t noticed the “this only needs to work within a single LAN” bit previously. The Dynamic DNS only necessary if the two devices which need to talk are NOT on the same LAN.

… and, reply to rw950431’s comment, below… I’ve only every worked via port forwarding. Not adequate for every scenario, of course… but I know nothing of anything fancier , so can’t comment.

@theskaz- apologies for missing the reference to ESP32. the ESP32 is still pretty new so support is a bit limited as you are finding. If you can live with the range limitations of BLE then its likely to give you lower latency than any Wifi solution.

@tkbyd- the difficulty I was referring to involves comms back from a mobile device on the internet to a device located typically behind a router/firewall. Most gateway devices dont allow inbound connections from the internet for security reasons. Either you use port-forwarding on the router (OK for home, not so feasible for school/office) or use some kind of tunneling service that eliminates the need for an inbound connection to a device on your local network. Dynamic DNS is only one part of that problem.