Skip to content

Satish-A-Wadekar/mqtt-with-mosquitto-broker-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MQTT with Mosquitto broker (Node.js Platform)

Features

This is a very quick & simple boilerplate where you can develop Node.js app with MQTT protocols for Pub/Sub message exchange module with the help of Mosquitto broker (custom configuration)

Installation

You need to install Mosquitto broker server on your machine to run this project locally, to install Mosquitto you can check this link https://mosquitto.org/download/.

Mosquitto can be installed from the homebrew project

  brew install mosquitto

Install all dependencies

  yarn install OR npm install

Environment Variables

To run this project, you will need to add the following environment variables to your .env file. I have already added env-template file in repo which you can use for your .env file setup

HOST

PORT

USERNAME

PASSWORD

TOPIC

Run Locally

Open 3 different terminal windows & run following commands on each separately

on first terminal window run index.js to start the mosquitto server

  node index.js

if you face any error while server starting, just kill all previously running mosquitto servers at your local. to do this just run following command

  killall mosquitto

on second terminal window run subscriber code

  node src/mqttSub.js

on third terminal window run publisher code

  node src/mqttPub.js

Badges

MIT License GPLv3 License AGPL License

Support

For support, email satish.a.wadekar@gmail.com.

About

a quick boilerplate of Python platform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published