How IoT devices connect to servers

I am working on an IoT project and I need the embedded device to be connected to the web service. So, what's better is requesting a web service every 1 or 2 seconds or opening a socket with a server to guarantee real-time operations.

Taking into account that working with sockets may require me to write many bundles of codes, since there are no frameworks for a socket through ARM.

thanks

+6
source share
2 answers

My team and I are currently working on the IOT platform, here are my suggestions:

  • If your product only periodically reports data or status, using a web service to retrieve data will work fine, and it is very easy to implement.
  • If you need to send real-time operations from the server to your device, using a long tcp connection is the best choice. There is a good protocol that will help you implement this, for example, MQTT.
  • In the second case above, a web service request for real-time operations will work, but it is definitely not a good idea. This will increase the server load and energy consumption of your device.

In the end, you need to make your choice according to your product requirements.

+3
source

You can use the MQTT protocol, its library is available for embedded c as well as for arduino. You can also select "Rest / Coap with nodejs" because the request will wait until the node gives an answer. In both of these scenarios, real-time communication can be achieved without any socket and update time.

+2
source

All Articles