mqtt

package
Version: v1.0.4-0...-0fdd48f Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client contains the mqtt client struct

func NewClient

func NewClient(opts Options) *Client

NewClient returns a mqtt client

func (*Client) Connected

func (client *Client) Connected() bool

Connected returns a bool if the MQTT client is connected or not

func (*Client) Start

func (client *Client) Start(ctx context.Context) error

Start starts the MQTT client

func (*Client) Stop

func (client *Client) Stop(ctx context.Context) error

StopWithContext takes a context and stops the server

type Options

type Options struct {
	BrokerAddresses []string
	Topic           string
	QoS             int
	ClientID        string
	Username        string
	Password        string
	CleanSession    bool
	KeepAlive       time.Duration
	ConnectTimeout  time.Duration
	StatusClient    status.Client
	MessageClient   message.Client
}

Options takes the input configuration for the mqtt client

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL