Documentation ¶
Index ¶
Constants ¶
View Source
const ( LevelTrace = slog.Level(-8) LevelFatal = slog.Level(12) )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the connection to the MQTT broker.
func NewClient ¶
func NewClient(ctx context.Context, prefs Preferences, subscriptions []*Subscription, configs []*Msg) (*Client, error)
type Device ¶
type Device interface { Name() string Configuration() []*Msg States() []*Msg Subscriptions() []*Subscription }
type Msg ¶
type Msg struct { Topic string Message json.RawMessage QOS byte Retained bool }
Msg represents a message that can be sent or received on the MQTT bus.
func NewMsg ¶
func NewMsg(topic string, msg json.RawMessage) *Msg
NewMsg is a convenience function to create a new Msg with a given topic and message body. The returned Msg can be further customised directly for specifying retention and QoS parameters, which are not set through this function and assumed to be left as their default values.
type Preferences ¶
type Subscription ¶
Subscription represents a listener on a specific Topic, that will pass any messages sent to that topic to the Callback function.
Click to show internal directories.
Click to hide internal directories.