mqtt

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiscoveryPrefix = "homeassistant"
	DefaultServer   = "localhost:1883"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewMQTTClient

func NewMQTTClient(preferences prefs) (*Client, error)

NewMQTTClient will establish a new connection to the MQTT service, using the configuration found under the path specified with prefsPath.

func (*Client) Publish

func (c *Client) Publish(msgs ...*Msg) error

func (*Client) Subscribe

func (c *Client) Subscribe(subs ...*Subscription) error

type Msg

type Msg struct {
	Topic    string
	Message  json.RawMessage
	QOS      byte
	Retained bool
}

type Subscription

type Subscription struct {
	Callback func(MQTT.Client, MQTT.Message)
	Topic    string
	QOS      byte
	Retained bool
}

Jump to

Keyboard shortcuts

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