paho

package
v0.0.0-...-ba1d20a Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneOptions

func CloneOptions(o *mqtt.ClientOptions) *mqtt.ClientOptions

CloneOptions creates a copy of the relevant mqtt options. It is used to create a per-device MQTT connection from template options. This is needed to satisfy the Homie spec which requires a dedicated connection to apply the last will to.

func Log

func Log(err error)

Log implements paho.ErrorHandler to log mqtt errors

Types

type ErrorHandler

type ErrorHandler func(err error)

ErrorHandler is the type MQTT error handlers must implement

type Handler

type Handler struct {
	Client       mqtt.Client
	Timeout      time.Duration
	ErrorHandler ErrorHandler
	// contains filtered or unexported fields
}

Handler is the MQTT adapter for Eclipse Paho

func NewHandler

func NewHandler(deviceRoot string, template *mqtt.ClientOptions, qos byte) *Handler

NewHandler creates a new MQTT client connection with applied last will

func (*Handler) Publish

func (h *Handler) Publish(topic string, retained bool, message string)

Publish implements homie.Publisher for Eclipse Paho

func (*Handler) Subscribe

func (h *Handler) Subscribe(topic string, callback homie.Callback)

Subscribe implements homie.Subscriber for Eclipse Paho

Jump to

Keyboard shortcuts

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