Lightweight MQTT client broker module written in Golang. Based on Eclipse Paho MQTT Go client and Mochi MQTT broker libraries
To use this module navigate to your project's root folder through a terminal and run the following:
- Run
go mod init
- Run
go get -u github.com/DeAntoLei/go-mqtt
- Run
go mod tidy
Then open all your source files that use the package and add the following to the imports section
- Add
import github.com/DeAntoLei/go-mqtt
Download the demo folder. This folder contains a client and a broker application.
- Open a terminal
- Navigate to demo folder
- Navigate to server folder:
cd broker
- Run broker application:
go run main.go
- Open a terminal
- Navigate to demo folder
- Navigate to client folder:
cd client
- Run broker application:
go run main.go