mqtt

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Conf Config
	mqtt.Client
}

func (*Client) Close

func (c *Client) Close() error

Close disconnects the MQTT client with a 5ms quiesce period.

func (*Client) Config

func (c *Client) Config() any

Config returns the embedded Conf as the configuration for injection.

func (*Client) Init

func (c *Client) Init() error

Init creates and connects the MQTT client.

type Config

type Config struct {
	*mqtt.ClientOptions
	Brokers    []string
	CAFile     string `json:"ca_file,omitempty"`
	ServerName string
}

func (*Config) AfterInject

func (c *Config) AfterInject()

AfterInject calls Init to finalize broker addresses and TLS config.

func (*Config) BeforeInject

func (c *Config) BeforeInject()

BeforeInject initializes the embedded ClientOptions with MQTT defaults.

func (*Config) Build

func (c *Config) Build() (mqtt.Client, error)

Build creates an MQTT client, connects to all configured brokers, and returns it.

func (*Config) Init

func (c *Config) Init() *Config

Init sets up TLS and broker addresses, logs warnings for unset timeouts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL