mqc

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opt *Options, logger *zap.SugaredLogger)

func Publish

func Publish(topic string, qos QOS, retain bool, payload []byte) error

func RegisterMultipleSubscriber

func RegisterMultipleSubscriber(topics map[string]byte, callback mqtt.MessageHandler)

func RegisterSubscriber

func RegisterSubscriber(topic string, qos QOS, handler mqtt.MessageHandler)

func ServerConnect

func ServerConnect()

ServerConnect will create a connection to the message broker, by default

func ServerDisconnect

func ServerDisconnect(quiesce uint)

ServerDisconnect Disconnect will end the connection with the server, but not before waiting the specified number of milliseconds to wait for existing work to be completed.

func Unsubscribe

func Unsubscribe(topic string)

Types

type Mqc

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

type Options

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

func NewOptions

func NewOptions(serverURL string, clientID string, username string, password string) *Options

func (*Options) SetConnectRetry

func (o *Options) SetConnectRetry(connectRetry bool, connectRetryInterval time.Duration) *Options

func (*Options) SetConnectTimeout

func (o *Options) SetConnectTimeout(connectTimeout time.Duration) *Options

func (*Options) SetKeepAlive

func (o *Options) SetKeepAlive(keepAlive time.Duration) *Options

type QOS

type QOS byte

QOS describes the quality of service of an mqtt publish

const (
	// AtMostOnce means the broker will deliver at most once to every subscriber - this means message delivery is not guaranteed
	AtMostOnce QOS = iota
	// AtLeastOnce means the broker will deliver a message at least once to every subscriber
	AtLeastOnce
	// ExactlyOnce means the broker will deliver a message exactly once to every subscriber
	ExactlyOnce
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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