A node.js MQTT broker app with (optional) data storage in MongoDB.
For an explanation of MQTT, see MQTT Essentials.
- Clone the repository and install the dependencies
git clone https://github.com/MarkNjunge/mqtt-broker.git
- Install dependencies
yarn install
- Create a .env file similar to .env.sample in the root directory.
cp .env.sample .env
- Run the broker
yarn start
Connect to the broker using the url mqtt://localhost:1883
using a client app such as MQTTBox.
To attach the broker to a http server, set ATTACH_HTTP
to true and HTTP_PORT
to your desired port. Then connect to ws://localhost:3000