mqtt

package
v0.0.0-...-52be9fe Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MQTT

type MQTT struct {
	ID string
	// contains filtered or unexported fields
}

func NewMQTT

func NewMQTT(id string, conn *MQTTConn, pubTopic string, subTopic string) *MQTT

func (*MQTT) AddListener

func (m *MQTT) AddListener(l MQTTListener)

func (*MQTT) OnMessage

func (m *MQTT) OnMessage(client mqtt.Client, msg mqtt.Message)

func (*MQTT) PublishValue

func (m *MQTT) PublishValue(value string)

type MQTTConn

type MQTTConn struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MQTTConn Object

func NewMQTTConn

func NewMQTTConn(broker string) *MQTTConn

NewMQTTConn creates a new MQTTConn Object, publishing and subscribing to the given broker/topic

func (*MQTTConn) Publish

func (m *MQTTConn) Publish(id, topic, payload string)

func (*MQTTConn) Subscribe

func (m *MQTTConn) Subscribe(topic string, handler MessageHandler)

type MQTTListener

type MQTTListener interface {
	OnValueChange(value string)
}

type MessageHandler

type MessageHandler interface {
	OnMessage(client mqtt.Client, msg mqtt.Message)
}

type Subscriber

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

Jump to

Keyboard shortcuts

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