HelloMQTT over TLS.
Fork of HelloMQTT by
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.
Revisions of MQTT.lib
Revision | Date | Message | Actions |
---|---|---|---|
9:5beb8609e9f7 | 2014-05-22 | Latest version | File Diff Annotate |
8:a3e3113054a1 | 2014-05-20 | Refactoring headers | File Diff Annotate |
7:3de634f2d40c | 2014-05-11 | Merge latest changes | File Diff Annotate |
6:e4c690c45021 | 2014-05-11 | Wildcard subscriptions | File Diff Annotate |
5:4a257f6ac09a | 2014-05-09 | Updates to the example to use the virtual serial port and the LCD for feedback | File Diff Annotate |
4:c696f27c1850 | 2014-05-09 | Update to sub-sub dependency | File Diff Annotate |
3:7a6a899de7cc | 2014-05-06 | Use latest MQTT library on both mbed and Linux | File Diff Annotate |
2:638c854c0695 | 2014-04-30 | Update to the latest level of code | File Diff Annotate |