mqtt

package
v0.0.0-...-c685a14 Latest Latest
Warning

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

Go to latest
Published: May 1, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultMessageHandler

func DefaultMessageHandler(client MQTT.Client, msg MQTT.Message)

func MQTTConfig

func MQTTConfig(broker, username, password string) *MQTT.ClientOptions

func MQTTConfigFromYAML

func MQTTConfigFromYAML(file string) (*MQTT.ClientOptions, error)

func NewSHA1Hash

func NewSHA1Hash(n int) string

func RandomString

func RandomString(n int) string

Types

type MQTTClient

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

func MQTTInit

func MQTTInit(broker, user, password string) (MQTTClient, error)

func (MQTTClient) Publish

func (mqtt MQTTClient) Publish(topic string, payload interface{})

func (MQTTClient) Subscribe

func (mqtt MQTTClient) Subscribe(topic string, cb MQTT.MessageHandler) error

func (MQTTClient) Unsubscribe

func (mqtt MQTTClient) Unsubscribe(topics ...string) error

type Mqtt

type Mqtt struct {
	Client struct {
		ConnectTimeout int    `yaml:"connectTimeout"`
		Username       string `yaml:"username"`
		Password       string `yaml:"password"`
	} `yaml:"client"`
	Broker struct {
		BrokerURL string `yaml:"url"`
	} `yaml:"broker"`
}

Jump to

Keyboard shortcuts

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