What is the Difference Between M2M and IoT

M2M represent the connections between machines to machines ,in M2M refers to the direct connection between two machines either using wired or wireless communication channels without human interaction , whereas IoT stand for Internet of Things, is based on a communication media likes sensors that can collect and analyze data in real-time. IoT is designed to be highly scalable because devices may also be included in the network and integrated into existing networks with minimal issues.

Difference Between M2M and IoT

Basis IoT M2M
protocol Using IoT has used internet protocols like FTP, Telnet, and HTTP. Communication technology and Traditional protocols are uses in M2M technology.
Connection type used The connection is a point to point The connection is via Network and using various communication types.
Scope It has a wide range of devices, yet the scope is large. It has a limited Scope for devices.
Open API Support IoT technology supports Open API integrations. In M2M technology, there is no Open API support.
Business Type IoT has Business to Consumer (B2C) and Business to Business (B2B). In M2M Business to Business (B2B) communication only.

How to install Mosquitto to use mqtt service in centos

To install Mosquitto to use mqtt service in centos we have to follow below steps

#sudo yum -y install epel-release

install Mosquitto to use mqtt service in centos step 1
#sudo yum -y install mosquitto

install Mosquitto to use mqtt service in centos step 2

#sudo systemctl start mosquitto

We also need to enable the service to make sure it starts up when we reboot the system

#sudo systemctl enable mosquitto

#mosquitto_pub -h localhost -t test -m "hello world"

Installing Let’s Encrypt SSL Certificates

sudo yum -y install certbot

Use firewall-cmd to add the HTTP service.

#sudo firewall-cmd --permanent --add-service=http

Reload the firewall so the changes take effect.

#sudo firewall-cmd --reload
#sudo certbot certonly --standalone --preferred-challenges http-01 -d mqtt.tutorialshore.com

Add a new user “user1”

# sudo mosquitto_passwd -c /etc/mosquitto/passwd user1
# sudo vi /etc/mosquitto/mosquitto.conf
add below line 

allow_anonymous false
password_file /etc/mosquitto/passwd/strong>


#sudo systemctl restart mosquitto

Now subscribe to a topic names “topic1”

#mosquitto_sub -h mqtt.tutorialshore.com-t topic1 -u "user1" -P "#password#"

open another terminal and get publish a message

#mosquitto_pub -h localhost -t "topic1" -m "Open window" -u "user1" -P "#password#"

Now restart Mosquitto .

#sudo systemctl restart mosquitto

Update the firewall to allow connections from port 1883.

#sudo firewall-cmd --permanent --add-port=1883/tcp

reload the firewall.

sudo firewall-cmd --reload

try connecting using any of the mqtt broker app like https://play.google.com/store/apps/details?id=in.dc297.mqttclpro

How to use MQTT Publish, Subscribe & Unsubscribe commands

MQTT Subscribe commands

Here is the MQTT Subscribe syntax to a particular topic (Hello_world)

 mosquitto_sub -h  'SERVER_IP_ADDRESS'  -t 'Hello_world' 

Here is the MQTT Subscribe syntax to a particular topic Hello_world with MQTT server with username and password

 mosquitto_sub -h  'SERVER_IP_ADDRESS' -u user -P pass -t 'Hello_world' 

Subscribing to all topics

 mosquitto_sub -h 'SERVER_IP_ADDRESS' -t \# -d 

MQTT Publish a message topic Hello_world

 mosquitto_pub -t ‘Hello_world’ -m hello