MQTT5 is the recommended MQTT Client. It has many benefits over MQTT311 outlined in the MQTT5 User Guide
- Node
- Browser
- Node
- Browser
All NodeJS samples will show their options by passing in --help
. For example:
# from the node/pub_sub folder
npm install
node dist/index.js --help
Which will result in output showing all of the options that can be passed in at the command line, along with descriptions of what each does and whether they are optional or not.
To enable logging in the NodeJS samples, add the following code to the sample:
const level = parseInt(io.LogLevel["ERROR"]);
io.enable_logging(level);
Note that the following log levels are available: TRACE
, DEBUG
, INFO
, WARN
, ERROR
, FATAL
, and NONE
. Once the code is added, logs will be printed to the console that then can be examined and shared to help debug issues.
If you are installing via npm instead of building from source, please make the following change to the package.json under each sample.
From:
"dependencies": {
"aws-iot-device-sdk-v2": "file:../../..",
"yargs": "^14.0.0"
}
To:
"dependencies": {
"aws-iot-device-sdk-v2": "<latest released version eg: ^1.3.0>",
"yargs": "^14.0.0"
}