mqttclient

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MqttClient

type MqttClient struct {
	MqttServerHost string
	MqttServerPort int
	ConfigPath     string
	Config         *viper.Viper
	Logger         log.FieldLogger
	MqttClient     interfaces.Client
}

MqttClient contains the data needed to connect the client

func GetMqttClient

func GetMqttClient(configPath string, onConnectHandler mqtt.OnConnectHandler, l log.FieldLogger) *MqttClient

GetMqttClient creates the mqttclient and returns it

func (*MqttClient) SendMessage

func (mc *MqttClient) SendMessage(ctx context.Context, topic string, message string) error

SendMessage sends the message with the given payload to topic

func (*MqttClient) SendRetainedMessage added in v0.3.0

func (mc *MqttClient) SendRetainedMessage(ctx context.Context, topic string, message string) error

SendRetainedMessage sends the message with the given payload to topic

func (*MqttClient) WaitForConnection added in v0.3.0

func (mc *MqttClient) WaitForConnection(timeout int) error

WaitForConnection to mqtt server

Jump to

Keyboard shortcuts

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