Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cembdc/go-mqtt-sample


https://github.com/cembdc/go-mqtt-sample

go go-mqtt golang golang-examples mqtt mqtt-client mqtt-server

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# MQTT Publisher/Subscriber

## Publisher
The publisher code publishes temperature, humidity, and light data at specific intervals using the MQTT protocol. A Publisher object is created for each data type, and messages are sent to the MQTT server by calling the publishMessage function with these objects. The newTLSConfig function is also defined to establish a secure connection using TLS.

## Subscriber
This code listens to temperature, humidity, and light data using the MQTT protocol. The SubscriberClient struct contains subscription information and topics. The subscribe function subscribes to specific topics and prints the messages to the console. The newTLSConfig function is also defined to establish a secure connection using TLS.