mqtt_client

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: MIT Imports: 3 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
}

func NewClient

func NewClient(cfg *Config) (client *Client, err error)

func (*Client) Connect

func (c *Client) Connect() (err error)

func (*Client) Disconnect

func (c *Client) Disconnect()

func (*Client) IsConnected

func (c *Client) IsConnected() bool

func (*Client) Publish

func (c *Client) Publish(topic string, payload interface{}) (err error)

func (*Client) Subscribe

func (c *Client) Subscribe(topic string, qos byte, callback MQTT.MessageHandler) (err error)

func (*Client) Unsubscribe

func (c *Client) Unsubscribe(topic string) (err error)

func (*Client) UnsubscribeAll

func (c *Client) UnsubscribeAll()

type Config

type Config struct {
	KeepAlive      int    `json:"keep_alive"`
	PingTimeout    int    `json:"ping_timeout"`
	Broker         string `json:"broker"`
	ClientID       string `json:"client_id"`
	ConnectTimeout int    `json:"connect_timeout"`
	CleanSession   bool   `json:"clean_session"`
	Username       string `json:"username"`
	Password       string `json:"password"`
	Qos            byte   `json:"qos"`
}

type Subscribe

type Subscribe struct {
	Qos      byte
	Callback MQTT.MessageHandler
}

Jump to

Keyboard shortcuts

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