MQTT connection
What is MQTT?
MQTT (Message Queuing Telemetry Transport) is an asynchronous and decoupled communication protocol that uses the publish / subscribe paradigm (like Twitter, for instance).
Publish/subscribe model
It is an asynchronous and decoupled communication paradigm. Subscribers (receivers) subscribe to topics and publishers (senders) publish messages on topics. The broker manages the topics: when a topic receives a message it is sent to all its subscribers. The topics allow a decoupling between publisher and subcriber.
Figure 1 - Example of communication between publishers and subscribers
Public MQTT broker
Here you can find a list of free and paid public MQTT brokers
https://github.com/mqtt/mqtt.github.io/wiki/public_brokers
Here's how to configure your test MQTT broker
Set the broker (server) domain name:
mqttserver=mqtt.teserakt.io
Set the port number:
mqttport=1883
Set the input topic:
mqttin=in
Set the output topic:
mqttout=out
Store the configuration:
] save
Connect to the broker
Connect to the Wi-Fi router first:
] wifi=1
ok
]
and wait for it to connect.
Wi-Fi connecting ...
]
Wi-Fi connected to 'Telekom-59086450' with IP: 192.168.1.252
]
After the connection there is an automatic connection to the NTP Server to update the calendar.
NTP connection to '0.de.pool.ntp.org' ...
NTP update of date and time: 19-04-2019 13:21:50
Then connect to the broker MQTT:
] mqtt=1
ok
]
and wait for it to connect.
MQTT connection to mqtt.teserakt.io:1883 ...
user: , client-ID: Smick-3448534573
subscribe to: in
publish on: out
]
MQTT connected to mqtt.teserakt.io:1883
]
< Conn
]
Sending the Conn
message indicates that the connection has been made.