sketching out clients

drew/add-droneio
Drew Bednar 4 months ago
parent 217f05223d
commit 245f99d333

@ -21,3 +21,11 @@ stop-dev:
install-dev-deps:
python3 -m pip install pre-commit
.PHONEY: install-dev-dep
run-pub:
go run ./cmd/publisher/main.go
.PHONEY: run-pub
run-sub:
go run ./cmd/subscriber/main.go
.PHONEY: run-sub

@ -2,8 +2,6 @@
Learning MQTT with Golang by doing. This repo is a simple example of using a Golang application as a client (pub & sub) of an MQTT broker.
8088, Management Center unsecured (opening the port on the internet is not recommended).
1883, Eclipse Mosquitto unsecured (opening the port on the internet is not recommended).
## Development
@ -39,7 +37,7 @@ make stop-dev
- [Mosquitto Docs](https://mosquitto.org/man/mosquitto-8.html)
- [Mosquitto TLS Tutorial](https://cedalo.com/blog/mqtt-tls-configuration-guide/)
- [Golang MQTT Tutorial]()
- [Golang MQTT Tutorial](https://www.emqx.com/en/blog/how-to-use-mqtt-in-golang)
- [MQTT as a Service](https://cedalo.com/mqtt-broker-pro-mosquitto/)
- [Using Wireshare for MQTT Analysis](https://cedalo.com/blog/wireshark-mqtt-guide/)
- [Caddy as reverse proxy](https://github.com/caddyserver/caddy)

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("MQTT Publisher")
}

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("MQTT Subscriber")
}

@ -3,11 +3,11 @@ package common
import "os"
// GetenvDefault retrieves an environment variable if set, or a provided default
func GetenvDefault(key string, d string) string {
val, ok := os.LookupEnv(key)
if ok {
func GetenvDefault(key string, defaultValue string) string {
val, exists := os.LookupEnv(key)
if exists {
return val
} else {
return d
return defaultValue
}
}

Loading…
Cancel
Save