mqtt

package
v1.0.0-rc0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidQOS = errors.New("invalid QOS type")

Functions

This section is empty.

Types

type Broker

type Broker struct {
	Server        types.Endpoint
	Retry         retry.Retry
	Timeout       types.Duration
	Keepalive     types.Duration
	RetainPublish bool
	QoS           QOS
	// contains filtered or unexported fields
}

func (*Broker) Client

func (b *Broker) Client(cid string) (*Client, error)

func (*Broker) ClientWithOptions

func (b *Broker) ClientWithOptions(cid string, opt *mqtt.ClientOptions) (*Client, error)

func (*Broker) Close

func (b *Broker) Close(cid string)

func (*Broker) Init

func (b *Broker) Init()

func (*Broker) SetDefault

func (b *Broker) SetDefault()

type Client

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

func (*Client) Cid

func (c *Client) Cid() string

func (*Client) Publish

func (c *Client) Publish(payload interface{}) error

func (*Client) Subscribe

func (c *Client) Subscribe(cb mqtt.MessageHandler) error

func (*Client) WithQoS

func (c *Client) WithQoS(qos QOS) *Client

func (*Client) WithRetain

func (c *Client) WithRetain(retain bool) *Client

func (*Client) WithTimeout

func (c *Client) WithTimeout(timeout time.Duration) *Client

func (*Client) WithTopic

func (c *Client) WithTopic(topic string) *Client

type QOS

type QOS int8
const (
	QOS_UNKNOWN        QOS = iota - 1
	QOS__ONCE              // 0
	QOS__AT_LEAST_ONCE     // 1
	QOS__ONLY_ONCE         // 2
)

func ParseQOSFromLabel

func ParseQOSFromLabel(s string) (QOS, error)

func ParseQOSFromString

func ParseQOSFromString(s string) (QOS, error)

func (QOS) ConstValues

func (v QOS) ConstValues() []enum.IntStringerEnum

func (QOS) Int

func (v QOS) Int() int

func (QOS) Label

func (v QOS) Label() string

func (QOS) MarshalText

func (v QOS) MarshalText() ([]byte, error)

func (*QOS) Scan

func (v *QOS) Scan(src interface{}) error

func (QOS) String

func (v QOS) String() string

func (QOS) TypeName

func (v QOS) TypeName() string

func (*QOS) UnmarshalText

func (v *QOS) UnmarshalText(data []byte) error

func (QOS) Value

func (v QOS) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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