HelloMQTT over TLS.

Dependencies:   MQTT

Fork of HelloMQTT by Osamu Koizumi

HelloMQTT over TLS

This program is a fork of HelloMQTT. Added TLS capability by using TLSSocket library. Tested on K64F.

This sample program connects to iot.eclipse.org:8883 by default. Verifies server identification. Subscribes a certain topic. Then publishes three messages with different QoSs, i.e. QoS0, QoS1, and QoS2.

Warning

Some brokers do not accept QoS2 and/or QoS1 message. For example, AWS IoT Message Broker doesn't accept QoS2. In such broker, this program doesn't work as is. Change QoS level.

Output from console

HelloMQTT: version is 0.70

Opening network interface...
Network interface opened successfully.

Connecting to host iot.eclipse.org:8883 ...
Connection established.

MQTT client is trying to connect the server ...
Client connected.

Client is trying to subscribe a topic "mbed-test".
Client has subscribed a topic "mbed-test".

Client publishes messages ...
Publishing message QoS 0.
QoS 0 message published.
! Message arrived: qos 0, retained 0, dup 0, packetid 6257
! Payload Hello World!  QoS 0 message from app version 0.700000

Publishing message QoS 1.
QoS 1 message published.
! Message arrived: qos 1, retained 0, dup 0, packetid 1
! Payload Hello World!  QoS 1 message from app version 0.700000

Publishing message QoS 2.
QoS 2 message published.
! Message arrived: qos 2, retained 0, dup 0, packetid 2
! Payload Hello World!  QoS 2 message from app version 0.700000

Version 0.70: finish 3 msgs

Known Issues

On K64F, when serial baud rate is changed from 9600 to 115200, program fails.

Changes

RevisionDateWhoCommit message
43:4dfeeaa9713e 2018-06-15 Osamu Koizumi Updated TLSSocket library. default tip
42:c88d777f2e00 2018-06-13 Osamu Koizumi Updated TLSSocket and change HelloMQTT to adopt it.
41:deed7540b456 2018-06-11 Osamu Koizumi Changed to use TLS by default.
40:43fefaef3c1a 2018-06-11 Osamu Koizumi branch merge
39:1421615a44f5 2018-06-11 Osamu Koizumi Modified for TLSSocket interface chnage. mutualAuth
38:e8b0157402c6 2018-06-11 Osamu Koizumi Remove unnecessary LCD options. Change serial baud rate to 9600. Higher baud rate caused error with Mosquitto broker at local environment. mutualAuth
37:fe3554458d2f 2018-06-11 Osamu Koizumi Updates to the latest. mutualAuth
36:2c69c42bd61c 2018-06-08 Osamu Koizumi Updated mbed-os mutualAuth
35:c8fd5859a455 2018-06-08 Osamu Koizumi Roll back easy-connect. mutualAuth
34:8f7a465c2192 2018-06-07 Osamu Koizumi Added mutual auth capability. mutualAuth
33:5107cc141dee 2018-04-25 Osamu Koizumi Updated TLSSocket library to latest.
32:989c4999ed6c 2018-04-24 Osamu Koizumi Updated TLSSocket library.
31:7dc71f2448d0 2018-04-17 Osamu Koizumi Updated TLSSocket library to latest.
30:b1937d7a0a82 2018-04-17 Osamu Koizumi Updated TLSSocket library.
29:bc323243010e 2018-04-17 Osamu Koizumi Changed print messages.
28:70c0694ae0cf 2018-04-17 Osamu Koizumi Added MQTT_server_setting.h
27:3be8f0cf77dc 2018-04-17 Osamu Koizumi Added TLSSocket library.
26:da69d4f89f8a 2018-04-17 Osamu Koizumi Changed setting to enable trace.
25:e3b39168ff00 2018-04-16 Osamu Koizumi Added TLS support.
24:e7cf8b02e012 2018-04-16 Osamu Koizumi Added TLS support.
23:e38aaf532823 2018-01-16 icraggs Update the MQTT library
22:f5f6c9059eed 2017-09-11 Jan Jongboom Roll back update to mbed OS 5.5
21:a68bd76740f9 2017-09-07 Jan Jongboom changeset: 21:6ab7c0b84d9e
20:49c9daf2b0ff 2017-01-10 Jan Jongboom Update to mbed OS 5, use NetworkInterface for multiple connectivity methods - not just ethernet
19:7f7aba7a4a8b 2015-07-30 icraggs Subscribe at QoS 2, remove lcd.cls() calls
18:07a79d8f01c3 2015-07-27 icraggs Make it easy to not use LCD screen, if you don't have one
17:0811bdbdd78a 2015-07-27 icraggs Make sure QoS 2 works
16:28d062c5522b 2014-10-06 icraggs Update to latest MQTT library - change some pointers to references
15:d8a31b66a85d 2014-08-01 icraggs Latest libraries
14:3c0b3663d448 2014-08-01 icraggs Merge
13:52a9dd92ce9d 2014-08-01 icraggs Latest library updates
12:086a9314e8a5 2014-08-01 icraggs Some cleaning up
11:5f6f8b0dd61d 2014-07-30 sam_grove Update to FP in MQTT library;
10:ce3321d8ea90 2014-07-07 ansond updates
9:5beb8609e9f7 2014-05-22 icraggs Latest version
8:a3e3113054a1 2014-05-20 icraggs Refactoring headers
7:3de634f2d40c 2014-05-11 icraggs Merge latest changes
6:e4c690c45021 2014-05-11 icraggs Wildcard subscriptions
5:4a257f6ac09a 2014-05-09 sam_grove Updates to the example to use the virtual serial port and the LCD for feedback
4:c696f27c1850 2014-05-09 sam_grove Update to sub-sub dependency
3:7a6a899de7cc 2014-05-06 icraggs Use latest MQTT library on both mbed and Linux
2:638c854c0695 2014-04-30 icraggs Update to the latest level of code
1:a1d5c7a6acbc 2014-02-05 icraggs Add copyright statement to main program
0:0cae29831d01 2014-02-04 icraggs Sample program for MQTT client