I read that many of the iot clouds are using MQTT protocol . If so to receive message from cloud to the device(iot gateway device such as esp8266 based device) will the iot gateway device need to connect with the cloud all the time?
or will it automatically connect when user send a message from his mobile app (similar to gcm) ?
as Iam not that much familiar In with this protocol side so am not getting the correct idea from internet if possible anybody please give the idea about how the cloud locate the device how it work on dynamic ip conditions ? or is der any methods other than ip?
As for EasyIOT cloud....yes your device need to be able to connect to the EasyIOT cloud to subscribe to its message topic...so the EasyIOT cloud acts as the publisher of the messages and the ESP8266 sends sensor data when it needs to...or like a light switch...it "pings" the publsh server to see if there are any new messages for it,....meaning 1 or 0 meaning light switch ON or OFF
MQTT protocol is not like http or another other old Internet protocal it is extreamly light weight and robust and is designed exactly for use on a sensor network or IOT network.... the following is taken from the MQTT site and should give you a warm feeling about using MQTT.
MQTT is a Client Server publish/subscribe messaging transport protocol. It is light weight, open, simple, and designed so as to be easy to implement. These characteristics make it ideal for use in many situations, including constrained environments such as for communication in Machine to Machine (M2M) and Internet of Things (IoT) contexts where a small code footprint is required and/or network bandwidth is at a premium.
The protocol runs over TCP/IP, or over other network protocols that provide ordered, lossless, bi-directional connections. Its features include:
· Use of the publish/subscribe message pattern which provides one-to-many message distribution and decoupling of applications.
· A messaging transport that is agnostic to the content of the payload.
· Three qualities of service for message delivery:
· "At most once", where messages are delivered according to the best efforts of the operating environment. Message loss can occur. This level could be used, for example, with ambient sensor data where it does not matter if an individual reading is lost as the next one will be published soon after.
· "At least once", where messages are assured to arrive but duplicates can occur.
· "Exactly once", where message are assured to arrive exactly once. This level could be used, for example, with billing systems where duplicate or lost messages could lead to incorrect charges being applied.
· A small transport overhead and protocol exchanges minimized to reduce network traffic.
· A mechanism to notify interested parties when an abnormal disconnection occurs.
thank you very much for giving a great replay many of my confusions are solved
if possible please clear one more doubt
while pinging the cloud the client updating any details such as ip or any other specific data for finding the client ? is IP having any role here ?
In simple MQTT is a tcp protocol that a simple sensor subscribes to a broker... The IP address of the sensor or the broker is only used as an address, the same way as a website has an address and you can browse with a browser. The biggest diffrence between HTTP and MQTT is that MQTT is really small, can be used on unrealiable networks like wifi and uses very little bandwidth compared to HTTP, also MQTT uses publish/subscribe architecture in contrast to HTTP with its request/response
So when I say that MQTT "pings" the broker it means that your sensor needs to know the IP of the broker....it then uses normal IP routing to find the broker whereever it is in the world, or on your local network....then it sends a really small packet of data (2bytes) to the broker. The difference to HTTP is that a client doesn’t have to pull the information it needs, but the broker pushes the information to the client, in the case there is something new. Therefore each MQTT client has a permanently open TCP connection to the broker. If this connection is interrupted by any circumstances, the MQTT broker can buffer all messages and send them to the client when it is back online.
So your Senor has code that Publishes to the EasyIOT cloud.... the sensors publishes to a specific topic on the EasyIOT cloud.... when you look at the EasyIOT cloud webpage its actually subscibing to the MQTT broker with your data, so if you sensor is sending Temp and Humidity data to the EasyIOT Cloud webpage, the webpage is looking at Temp and Humidy and subscribing to those topics..... If you Sensor is a switch. then the EasyIOT cloud webpage is not only subscribing to the broker but it is publishing to the broker...so that you can turn the swich on and off.