mqtt

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultQoS = 1

DefaultQoS is the default quality of service value.

Variables

This section is empty.

Functions

func ParseQuery added in v0.9.3

func ParseQuery(query string) (url.Values, error)

Types

type ModuleTransport

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

func NewModuleTransport

func NewModuleTransport(opts ...TransportOption) *ModuleTransport

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

func (*ModuleTransport) Connect

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

func (*ModuleTransport) Send

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

func (*ModuleTransport) SubscribeEvents

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

type Transport

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

func New

func New(opts ...TransportOption) *Transport

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

func (*Transport) Close

func (tr *Transport) Close() error

func (*Transport) Connect

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

func (*Transport) GetBlobSharedAccessSignature

func (tr *Transport) GetBlobSharedAccessSignature(ctx context.Context, blobName string) (string, string, error)

GetBlobSharedAccessSignature is not available in the MQTT transport.

func (*Transport) NotifyUploadComplete

func (tr *Transport) NotifyUploadComplete(ctx context.Context, correlationID string, success bool, statusCode int, statusDescription string) error

NotifyUploadComplete is not available in the MQTT transport.

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

func (tr *Transport) SetLogger(logger logger.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)

func (*Transport) UploadToBlob

func (tr *Transport) UploadToBlob(ctx context.Context, sasURI string, file io.Reader, size int64) error

UploadToBlob is not available in the MQTT transport.

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 logger.Logger) TransportOption

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

func WithModelID

func WithModelID(modelID string) TransportOption

WithModelId makes the mqtt client register the specified DTDL modeldID when a connection is established, this is useful for Azure PNP integration.

func WithWebSocket

func WithWebSocket(enable bool) TransportOption

WithWebSocket makes the mqtt client use MQTT over WebSockets on port 443, which is great if e.g. port 8883 is blocked.

Jump to

Keyboard shortcuts

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