mqtt

package
Version: v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoConnection = errors.New("no connection to broker server")

Functions

This section is empty.

Types

type MQTTBroker

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

MQTTBroker implements broker.Broker interface.

func NewBroker

func NewBroker(opts ...Option) (*MQTTBroker, error)

NewBroker creates new mqtt broker.

func (*MQTTBroker) Connect

func (m *MQTTBroker) Connect() error

func (*MQTTBroker) Disconnect

func (m *MQTTBroker) Disconnect() error

func (*MQTTBroker) Publish

func (m *MQTTBroker) Publish(topic string, payload interface{}) error

func (*MQTTBroker) String

func (m *MQTTBroker) String() string

func (*MQTTBroker) Subscribe

func (m *MQTTBroker) Subscribe(topics []string, h broker.Handler) error

type Option

type Option func(m *MQTTBroker) error

func WithClientID

func WithClientID(id string) Option

WitClientID returns an Option which set the broker client id.

func WithPassword

func WithPassword(password string) Option

WithPassword returns an Option which set the password use to connect to server.

func WithURL

func WithURL(u string) Option

WithURL returns an Option which set the broker url.

func WithUsername

func WithUsername(username string) Option

WithUsername returns an Option which set the username use to connect to server.

Source Files

Jump to

Keyboard shortcuts

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