This folder contains samples to subscribe and receive messages as well as publish messages to custom topics using Javascript and Node
First, install the MQTT library from your command-line environment:
npm install mqtt --save
Then, implement the client in a NodeJs script. Replace the following placeholders with information for your IoT Hub and devices used to connect to the broker
- IotHubHostName
- DeviceId
- SasKey
- Path_to_cert
NodeJS Mqtt documentation can be accessed on following URL: link