Control MKR1000 from web

Hello, everyone. I hope I am posting this in the right area. I would like some guidance on how I can communicate with my arduino mkr1000 from the internet. Currently, I have a single LED connected to it and I have aREST, WiFi101 included in the sketch. If I upload the sketch, I can access a page and see what looks to be JSON details. I am able to hit various links, Or 1 to turn the LED on or off. Everything works great... except for that it seems to fall of the network and stops responding after a few minutes... but that is beside the point at this moment.

What will I have to do in order to send instructions to this mkr1000 from anywhere outside of the WiFi zone, without using port forwarding. I have googled quite a few things and have come across a TON of different articles, but not one that seems to address this.

I just want to either have the device ping a server, ask if there is any data for it, if so, accept the data and process the data. In this case, should the LED be on or off. OR, is it better to host the device on an IoT server, if that is even a thing, or if Azure is capable of this and communicate with it that way? Or, is there an option to send or receive JSON strings to control the device? Or, should I connect it to a db and then get and post to that? Anyway, I am not seeing a lot of articles that tackle this. What have you tried and what seems to be the best method? I'm grateful for any assistance. Thank you.

to access systems behind NAT boxes I have used

  1. port forwarding - this requires access to the NAT box which may not be available or is at a cost
  2. the client (behind the NAT box) make a regular TCP connection to an external server to check for data
  3. the client is also equiped with a GSM modem - the external server calls the GSM modem to tell the client to make a TCP connection the server

Adafruit runs an IOT service based on MQTT which does something of what you want. Here is an example project. Adafruit IO is free only for small demo projects.

Another free service that that has a dashboard interface and does MQTT is Cayenne. I use it to view sensor readings and have used it in the past to also send commands to the IoT device but after an update it no longer works on IOS 9 as both an App or in Safari so I now also use Dweet to pass data between systems.