client

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MqttPayloadToBytes

func MqttPayloadToBytes(payload interface{}) ([]byte, error)

func NewErrorToken

func NewErrorToken(err error) mqtt.Token

func NewNamespaceClientOptions added in v1.1.0

func NewNamespaceClientOptions(clientId string) *mqtt.ClientOptions

func SetFactory

func SetFactory(fac Factory)

Types

type Factory

type Factory func(options config.MqttClientConfig, onConnect func(mqtt.Client)) (mqtt.Client, error)
var ClientFactory Factory

type PublishingConfig

type PublishingConfig struct {
	SubscriptionConfig
	// contains filtered or unexported fields
}

func NewTopicConfig

func NewTopicConfig(topic string) PublishingConfig

func (*PublishingConfig) Publish

func (a *PublishingConfig) Publish(target mqtt.Client, payload interface{}) mqtt.Token

func (*PublishingConfig) RetainFlag

func (a *PublishingConfig) RetainFlag() bool

func (*PublishingConfig) WithRetainFlag

func (a *PublishingConfig) WithRetainFlag(retain bool)

type QoS

type QoS byte
const (
	AtMostOnce  QoS = 0
	AtLeastOnce QoS = 1
	ExactlyOnce QoS = 2
)

type Subscription

type Subscription interface {
	PayloadFactory() interface{}
	SubscriptionHandler(payload interface{}, err error)
}

type SubscriptionConfig

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

func (*SubscriptionConfig) QualityOfService

func (a *SubscriptionConfig) QualityOfService() QoS

func (*SubscriptionConfig) Subscribe

func (a *SubscriptionConfig) Subscribe(target mqtt.Client, subscription Subscription) mqtt.Token

func (*SubscriptionConfig) Topic

func (a *SubscriptionConfig) Topic() string

func (*SubscriptionConfig) WithQualityOfService

func (a *SubscriptionConfig) WithQualityOfService(qos QoS)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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