flagmqtt

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MqttAddressFlag          = flag.String("mqtt.address", "localhost:1883", "Address to MQTT endpoint")
	MqttUsernameFlag         = flag.String("mqtt.username", "", "MQTT Username")
	MqttPasswordFlag         = flag.String("mqtt.password", "", "MQTT Password")
	MqttTLSFlag              = flag.Bool("mqtt.tls", false, "Enable TLS")
	MqttCAFlag               = flag.String("mqtt.ca", "", "Path to CA certificate")
	MqttCertFlag             = flag.String("mqtt.cert", "", "Path to Client certificate")
	MqttKeyFlag              = flag.String("mqtt.key", "", "Path to Client certificate key")
	MqttConnectionTimeout    = flag.Int("mqtt.connection-timeout", 10, "Connection timeout in seconds")
	MqttKeepAlive            = flag.Int("mqtt.keepalive", 5, "Time in seconds between each PING packet")
	MqttMaxReconnectInterval = flag.Int("mqtt.max-reconnect-interval", 2, "Maximum time in minutes to wait between reconnect attemps")
	MqttPingTimeout          = flag.Int("mqtt.ping-timeout", 10, "Time in seconds after which a ping times out")
	MqttWriteTimeout         = flag.Int("mqtt.write-timeout", 5, "Time in seconds after which a write will time out")
)

Functions

func NewPersistentMqtt

func NewPersistentMqtt(config ClientConfig) (mqttClient mq.Client, err error)

func NewUniqueIdentifier

func NewUniqueIdentifier() string

NewUniqueIdentifier returns a unique identifier that the client can use. This identifier is what should be set for the lastWillID for anything that is bridging more than one device

Types

type ClientConfig

type ClientConfig struct {
	WillTopic               string
	WillPayload             string
	WillQoS                 int
	WillRetain              bool
	ClientID                string
	OnConnectHandler        func(mq.Client)
	OnConnectionLostHandler func(mq.Client, error)
}

Jump to

Keyboard shortcuts

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