mqtt

package
v1.1.46 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RestoreTopics added in v1.1.26

func RestoreTopics(ctx context.Context, server string, topicsBackup TopicsBackup) error

RestoreTopics publishes topics from topicsBackup as retaines

Types

type MqttClient

type MqttClient struct {
	// contains filtered or unexported fields
}

func NewMqttClient

func NewMqttClient(params MqttParams) *MqttClient

func (*MqttClient) Close

func (mqttClient *MqttClient) Close()

func (*MqttClient) Connect

func (mqttClient *MqttClient) Connect(ctx context.Context) error

func (*MqttClient) Disconnect

func (mqttClient *MqttClient) Disconnect(ctx context.Context) error

func (*MqttClient) Done

func (mqttClient *MqttClient) Done() <-chan struct{}

func (*MqttClient) IncomingMessages

func (mqttClient *MqttClient) IncomingMessages() <-chan *paho.Publish

func (*MqttClient) Publish

func (mqttClient *MqttClient) Publish(ctx context.Context, p *paho.Publish) error

func (*MqttClient) Subscribe

func (mqttClient *MqttClient) Subscribe(ctx context.Context, s *paho.Subscribe) error

type MqttParams

type MqttParams struct {
	ServerURL            string
	ClientID             string
	InitialSubscriptions *paho.Subscribe
}

type TopicsBackup added in v1.1.25

type TopicsBackup map[string]string

TopicsBackup holds the mqtt topics values

func BackupTopics added in v1.1.25

func BackupTopics(ctx context.Context, server string, topics []string) (TopicsBackup, error)

BackupTopics connects to a mqtt server and writes the topics and their content into the writer

Jump to

Keyboard shortcuts

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