Giter VIP home page Giter VIP logo

mqtt-client-go's Introduction

Mqtt Client

  • Across Platform (Golang)
  • Supports multiple client specifications
    • All they need is to implement in the Client interface
  • Log systems

TODO

  • Add Other Clients
  • MQTT Interfaces Specifications (Doc)

File

.
├── client                  - Client Pkg
│   ├── client.go           - client Definition
│   ├── cmd                 - Cmd Definition (Interface)
│   │   └── cmd.go
│   └── robot               - Client Robot (Implementation) * Main Controller
│       ├── robot_cmd.go
│       ├── robot.go
│       └── robot.toml
├── config                  - Config Loader
│   ├── config.go
│   └── config.toml
├── config.toml
├── go.mod
├── go.sum
├── logger                  - Logger
│   └── log.go
├── main.go
├── Makefile
├── mosquitto               - mosquitto built (amd64)
│   ├── mosquitto.conf
│   └── mosquitto_linux
├── README.md
├── reply                   - mqtt reply helper
│   └── reply.go
├── robot.toml
└── runtime                 - runtime generated Logs & Stuff
    ├── app.log
    ├── mqtt_critical.log
    ├── mqtt_debug.log
    ├── mqtt_error.log
    └── mqtt_warn.log

9 directories, 24 files

Usage

1. Build towards Platform Specification

  • Example: Robot (aarch64)
  • Building Options: GOOS=linux GOARCH=arm64 go build .

2. Copy configuration & binary application to Client

  • scp ./mqttclient config.toml robot.toml huanyu:~/Coding/mqtty_go/

3. Check configuration on Robot

4. Run Client

  • ./mqttclient

Configuration

config.toml

  • Example Configuration
# Mqtt Configuration
ctype = "ROBOT"                 # Client Type: ROBOT, WIFI, SPEAKER
cconfig = "./client/robot.toml" # Client Configuration File

[MQTT]
address = "127.0.0.1:1883"          # Mqtt Address
error_file = "mqtt_error.log"       # Error Log file
critical_file = "mqtt_critical.log" # Criti Log file
warn_file = "mqtt_warn.log"         # Warn Log file
debug_file = "mqtt_debug.log"       # Debug Log file
showlog = false                     # Show mqtt Log : false/true

[LOG]
level = "TRACE"      # "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL", "PANIC"
filename = "app.log" # Log file name

robot.toml

  • Example Configuration
deviceId = "Robot1"
devType = "Robot"

Extensions

  • Up till now (01/12/2024), this application supports only Robot Client. Yet the architecture can boot other client specifications if they implement the Client and CMDManager interfaces.

mqtt-client-go's People

Contributors

chrisvicky avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.