Skip to content
Takatoshi Kondo edited this page May 20, 2019 · 9 revisions

MQTT v5

mqtt_cpp supports MQTT v5 since version 4.0.0.

client

When you create a client, pass the protocol_version argument. If you want to use MQTT v5, then you create the client as follows:

    auto c = mqtt::make_sync_client(ios, "localhost", port, mqtt::protocol_version::v5);

The default protocol_version is v3_1_1. So the following two code is the same meaning:

    auto c = mqtt::make_sync_client(ios, "localhost", port, mqtt::protocol_version::v3_1_1);
    auto c = mqtt::make_sync_client(ios, "localhost", port);
Clone this wiki locally