On each different layer ,IoT an its connected devices use different Messaging Protocols for communication.It is important to choose correct protocol ,which depends on layers and function of device.MQTT, HTTP/HTTPS/REST, SMTP, COAP are some of the messaging protocols.

Let's move on brief information of this messaging protocols:

1.MQTT: It stands for Message Queuing Telemetry transport
and is commonly used protocol in IOT Projects.The main motive behind this was The motivation for designing MQTT was to create lightweight and bandwidth-efficient protocol.

How it will works:
As it is based on client and server ,is used to
communicate device data to the servers. MQTT server is also called as broker and clients are connected devices.Publish means when client wants to send data to broker and subscribe means when client wants to receive the data.
MQTT messages are send asynchronously using publish-
subscribe module.This messages are then enclosed in different control packets. variable header and payload is an optional,not all packets have this parameters.
checkout this for MQTT details
(https://www.hiotron.com/basics-mqtt-messaging-protocol-internet-things/).

2.HTTP:It stands for HyperText Transfer Protocol.It is used by world wide web to define how messages are
formatted and transmitted. It will execute each command individually hence it has been called an stateless protocol. Another secure version of the HTTP is HTTPS.

How it will works:
HTTP is an request server protocol.When web browser
request to server which consist an request line,set of
request headers and an entity.To that request server sends an response.
The entity may be an binary data.After completion of response either browser or the server will terminate the TCP/IP connection.

3.SMTP:It stands for Simple Mail Transfer Protocol.This protocol will moves an email on and across the networks.

How it will works:
SMTP uses an store and forward process.By using this
feature messages can move from source computer to the
destination. It works with an mail transfer agent to send an messages to the destination computer and in email inbox.It provides an set of codes.When we send message it will break it into strings of text which will separated by the numbers so that will identify the purpose.

4.COAP:It stands for Constrained Application Protocol.COAP used for an machine-to-machine
communication.It's feature of low bandwidth and low availability make it useful for an IoT Projects.It can simply run on the devices that supports UDP.

How it will works:
COAP server will be installed on the destination node,which could be a sensor.At the other side COAP
client should installed on the controller which
manages end nodes.It makes use of two message types a
request and its responses for the communication.

For More details of messaging protocols visit: https://www.hiotron.com/iot-training/

Author's Bio: 

Hiotron Pvt.Ltd (hIOTron) is an IoT solution and services providers in india who mainly focused on development and implementation of IoT Products.
Hiotron had deployed over 21000 IoT Devices. hIoTron's IoT platform helps businesses to connect and manage data securely.It also develops,supports and manufactures IoT
platforms and serving 55+ Fortune Enterprises.