mqtt

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package mqtt hold the implementation of the Publisher and PubSub interfaces for the MQTT messaging system, the internal messaging broker of the Magistrala IoT platform. Due to the practical requirements implementation Publisher is created alongside PubSub. The reason for this is that Subscriber implementation of MQTT brings the burden of additional struct fields which are not used by Publisher. Subscriber is not implemented separately because PubSub can be used where Subscriber is needed.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConnect indicates that connection to MQTT broker failed.
	ErrConnect = errors.New("failed to connect to MQTT broker")

	// ErrSubscribeTimeout indicates that the subscription failed due to timeout.
	ErrSubscribeTimeout = errors.New("failed to subscribe due to timeout reached")

	// ErrUnsubscribeTimeout indicates that unsubscribe failed due to timeout.
	ErrUnsubscribeTimeout = errors.New("failed to unsubscribe due to timeout reached")

	// ErrUnsubscribeDeleteTopic indicates that unsubscribe failed because the topic was deleted.
	ErrUnsubscribeDeleteTopic = errors.New("failed to unsubscribe due to deletion of topic")

	// ErrNotSubscribed indicates that the topic is not subscribed to.
	ErrNotSubscribed = errors.New("not subscribed")

	// ErrEmptyTopic indicates the absence of topic.
	ErrEmptyTopic = errors.New("empty topic")

	// ErrEmptyID indicates the absence of ID.
	ErrEmptyID = errors.New("empty ID")
)

Functions

func NewPubSub

func NewPubSub(url string, qos uint8, timeout time.Duration, logger *slog.Logger) (messaging.PubSub, error)

NewPubSub returns MQTT message publisher/subscriber.

func NewPublisher

func NewPublisher(address string, qos uint8, timeout time.Duration) (messaging.Publisher, error)

NewPublisher returns a new MQTT message publisher.

Types

This section is empty.

Jump to

Keyboard shortcuts

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