Back to godoc.org

Package mqtt

v0.0.0-...-4928083
Latest Go to latest

The latest major version is .

Published: Aug 26, 2020 | License: GPL3 | Module: github.com/bizflycloud/bizfly-backup

Index

Variables

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

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.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier