mqtt

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMessageHandler

func NewMessageHandler(metric config.Metric, collector prometheus.Collector) pahomqtt.MessageHandler

NewMessageHandler constructs handler for single metric.

Types

type Listener

type Listener interface {
	Subscribe(topic string, mh pahomqtt.MessageHandler) error
	Close()
	Check(ctx context.Context) error
}

Listener provides actions over MQTT client.

func NewListener

func NewListener(lo ...ListenerOption) (Listener, error)

NewListener creates listener over MQTT client.

type ListenerOption

type ListenerOption func(options *pahomqtt.ClientOptions)

ListenerOption allows to configure MQTT client.

func WithHostAndPort

func WithHostAndPort(host string, port int) ListenerOption

WithHostAndPort is option that defines MQTT broker.

func WithPassword

func WithPassword(password string) ListenerOption

WithPassword is option that sets connection credentials.

func WithTimeout

func WithTimeout(timeout time.Duration) ListenerOption

WithTimeout is option that sets MQTT client timeout.

func WithUsername

func WithUsername(username string) ListenerOption

WithUsername is option that sets connection credentials.

Jump to

Keyboard shortcuts

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