mqtt

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2019 License: MIT Imports: 12 Imported by: 21

Documentation

Index

Constants

View Source
const DefaultQoS = 1

DefaultQoS is the default quality of service value.

Variables

This section is empty.

Functions

func New

func New(opts ...TransportOption) transport.Transport

NewLogger returns new Transport transport. See more: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-mqtt-support

Types

type Transport

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

func (*Transport) Close

func (tr *Transport) Close() error

func (*Transport) Connect

func (tr *Transport) Connect(ctx context.Context, creds transport.Credentials) error

func (*Transport) RegisterDirectMethods

func (tr *Transport) RegisterDirectMethods(ctx context.Context, mux transport.MethodDispatcher) error

func (*Transport) RetrieveTwinProperties

func (tr *Transport) RetrieveTwinProperties(ctx context.Context) ([]byte, error)

func (*Transport) Send

func (tr *Transport) Send(ctx context.Context, msg *common.Message) error

func (*Transport) SetLogger added in v0.1.0

func (tr *Transport) SetLogger(logger common.Logger)

func (*Transport) SubscribeEvents

func (tr *Transport) SubscribeEvents(ctx context.Context, mux transport.MessageDispatcher) error

func (*Transport) SubscribeTwinUpdates

func (tr *Transport) SubscribeTwinUpdates(ctx context.Context, mux transport.TwinStateDispatcher) error

func (*Transport) UpdateTwinProperties

func (tr *Transport) UpdateTwinProperties(ctx context.Context, b []byte) (int, error)

type TransportOption

type TransportOption func(tr *Transport)

TransportOption is a transport configuration option.

func WithClientOptionsConfig

func WithClientOptionsConfig(fn func(opts *mqtt.ClientOptions)) TransportOption

WithClientOptionsConfig configures the mqtt client options structure, use it only when you know EXACTLY what you're doing, because changing some of opts attributes may lead to unexpected behaviour.

Typical usecase is to change adjust connect or reconnect interval.

func WithLogger

func WithLogger(l common.Logger) TransportOption

WithLogger sets logger for errors and warnings plus debug messages when it's enabled.

Jump to

Keyboard shortcuts

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