mqtt

package
v0.0.0-...-ca90ad5 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NAME    = "mqtt"
	VERSION = "1.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

func New

func New(opts ...Option) *Handler

New initializes the plugin

func (*Handler) Name

func (h *Handler) Name() string

Name returns the name of the plugin

func (*Handler) Publish

func (h *Handler) Publish(e *integration.Event) error

func (*Handler) Shutdown

func (h *Handler) Shutdown()

Close closes all connections and channels

func (*Handler) Subscribe

func (h *Handler) Subscribe(e <-chan integration.Event) error

func (*Handler) Version

func (h *Handler) Version() string

Version returns the version of the plugin

type Option

type Option func(*Handler)

func ClientID

func ClientID(s string) Option

ClientID overrides the name as which to connect to mqtt (Default: uuid)

func Debug

func Debug(b bool) Option

Debug enable or disabled debug

func MessageReader

func MessageReader(messageReader func(client mqtt.Client, msg mqtt.Message)) Option

MessageReader overrides the default message handler for reads

func MessageWriter

func MessageWriter(messageWriter func(topic string, qos byte, retained bool, payload interface{}) error) Option

MessageWriter overrides the default message handler for reads

func Topic

func Topic(s string) Option

Topic adds a subscription to a topic (can be used multiple times)

Jump to

Keyboard shortcuts

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