This repository contains MQTT-SN clients based on wolfMQTT's wolfMQTT/examples/sn-client
Clone this repository and navigate to the project directory. Run the wolfSSL installation script:
./scripts/install_wolfssl.sh
By default, this script installs wolfSSL version 5.6.4-stable
. You can change the version by modifying the INSTALL_TAG
variable in the install_wolfssl.sh
script.
After installing wolfSSL, install wolfMQTT:
./scripts/install_wolfMQTT.sh
By default, this script installs wolfMQTT version 1.19.0
. You can change the version by modifying the INSTALL_TAG
variable in the install_wolfMQTT.sh
script.
Note: Ensure that the versions of wolfSSL and wolfMQTT are compatible with each other and with the MQTT-SN clients in this repository.
You can configure the key exchange groups for TLS/DTLS connections by defining MQTT_WOLFSSL_GROUPS
in src/common/mqttexample.c
. This setting defines which groups will be allowed for key exchange during the TLS handshake.
For example, to set P-256 as the key exchange group:
#define MQTT_WOLFSSL_GROUPS "P-256"
or KYBER_LEVEL_1
if PQC is enabled.
mkdir build
cd build
cmake ..
make
Alternatively, you can run the ./scripts/build_clients.sh
script.
To run the MQTT-SN client:
./build/bin/sn-client -t
To run the MQTT-SN publisher:
./build/bin/sn-pub -t
To run the MQTT-SN subscriber:
./build/bin/sn-sub -t
The repository includes a test script (test.sh
) to evaluate both publisher and subscriber clients.
./test.sh [-n iterations] [-m pub|sub]
Options:
-n
: Number of iterations (default: 1)-m
: Mode - 'pub' for publisher or 'sub' for subscriber (default: pub)
For example, to run the publisher 5 times:
./test.sh -n 5 -m pub