Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README.md: Add some notes on differences when using MQTTv5 client #1488

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ Samples are available in the Doxygen docs and also in `src/samples` for referenc
- *MQTTClient_publish.c, MQTTClient_subscribe.c* and *MQTTClient_publish_async.c:* MQTTClient simple code examples
- *MQTTAsync_publish.c* and *MQTTAsync_subscribe.c:* MQTTAsync simple code examples

There are differences between MQTTv3 and MQTTv5 in terms of how the client needs to be created, connections established and so forth

e.g.

```
MQTTAsync_createOptions create_opts = MQTTAsync_createOptions_initializer5;
...
MQTTAsync_createWithOptions(&client, url, opts.clientid, MQTTCLIENT_PERSISTENCE_NONE,
NULL, &create_opts);
...
MQTTAsync_connectOptions conn_opts5 = MQTTAsync_connectOptions_initializer5;
...
MQTTAsync_connect(client, &conn_opts)) != MQTTASYNC_SUCCESS)
...
```

For further details see one of the samples e.g. [here](https://github.com/eclipse/paho.mqtt.c/blob/6b1e202a701ffcdaa277b5644ed291287a70a7aa/src/samples/paho_c_sub.c)

Some potentially useful blog posts:

- [Paho client MQTT 5.0 support and command line utilities](https://modelbasedtesting.co.uk/2018/08/08/paho-c-client-mqtt-5-0-and-command-line-utilities/)
Expand Down Expand Up @@ -134,6 +152,8 @@ paho-mqtt3cs-static | synchronous with SSL/TLS support, static linkage

Remember, though, that not all of these targets may be available. It depends on how the library was built.

Also note that although these targets include "3" in the suffix they do support MQTTv5.

A sample *CMakeLists.txt* for an application that uses the asynchronous library with encryption support *(paho-mqtt3as)* might look like this:

```
Expand Down
Loading