Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How IoT devices connect to servers

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

Taking into Consideration that working with sockets, may require me to write a lot of bunches of codes, as there's no frameworks for socket over ARM for example.

Thanks

like image 466
Mostafa Khattab Avatar asked Aug 19 '15 09:08

Mostafa Khattab


2 Answers

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

  1. If your product only report data or status periodically, using a web service to receive the data will work fine, and it's very easy to implement.
  2. If you need to send realtime operations from server to your device, using a long tcp connection is a better choice. There are some good protocol to help you implement this, like MQTT.
  3. For the second case above, requesting a web service to receive realtime operations will work, but it's definitely not a good idea. It will increase your server's load and your device's energy consumption.

After all, you need to make your choice on your product's requirements.

like image 154
razr Avatar answered Nov 06 '22 01:11

razr


You can use MQTT protocol, its library is available for embedded c as well as for arduino. Also you can choose, Rest/Coap with nodejs as the request will be waiting until node will give response In this both scenario, real time communication can be approached without any socket and refreshing time.

like image 24
Samrat Das Avatar answered Nov 06 '22 01:11

Samrat Das