mqtt

package
v3.24.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package mqtt implements the MQTT provider using the mqtt driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenConnection added in v3.9.0

func OpenConnection(ctx context.Context, settings Settings, topics provider.Topics) (pc *provider.Connection, err error)

OpenConnection opens a MQTT connection using the given settings.

func OpenSubscription

func OpenSubscription(ctx context.Context, client mqtt.Client, topicName string, qos byte) (*pubsub.Subscription, error)

OpenSubscription returns a *pubsub.Subscription that subscribes to the given topic name with the given MQTT client.

func OpenTopic

func OpenTopic(client mqtt.Client, topicName string, qos byte) (*pubsub.Topic, error)

OpenTopic returns a *pubsub.Topic that publishes to the given topic name with the given MQTT client.

Types

type HTTPHeadersProvider added in v3.9.2

type HTTPHeadersProvider func(context.Context) (headers http.Header, err error)

HTTPHeadersProvider provides HTTP headers as they are needed by the MQTT client.

type Settings added in v3.9.2

type Settings struct {
	URL,
	ClientID,
	Username,
	Password string
	TLS                 *tls.Config
	HTTPHeadersProvider HTTPHeadersProvider
	PublishQoS,
	SubscribeQoS byte
	WebSocketReadBufferSize,
	WebSocketWriteBufferSize int
}

Settings configure the MQTT client.

Jump to

Keyboard shortcuts

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