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
}
Client is a structure for managing the MQTT connection
func (*Client) Disconnect ¶
Disconnect disconnects from the MQTT broker
func (*Client) Publish ¶
func (c *Client) Publish(p PublishPayload) error
Publish publishes a message to an MQTT topic
func (*Client) Subscribe ¶
func (c *Client) Subscribe(topic string, handler mqtt.MessageHandler) error
Subscribe subscribes to an MQTT topic
func (*Client) Unsubscribe ¶
Unsubscribe unsubscribes from MQTT topics
type ClientInterface ¶
type ClientInterface interface { // Subscribe subscribes to an MQTT topic with a given message handler. Subscribe(topic string, handler mqtt.MessageHandler) error // Publish publishes a message to an MQTT topic with the specified payload. Publish(p PublishPayload) error // Unsubscribe unsubscribes from one or more MQTT topics. Unsubscribe(topics ...string) error // Disconnect disconnects from the MQTT broker with the specified quiesce timeout. Disconnect(quiesce uint) // GetClient returns the underlying MQTT client. GetClient() mqtt.Client }
ClientInterface defines an interface for MQTT client functionality.
func NewClient ¶
func NewClient(opt Options) (ClientInterface, error)
NewClient creates a new MQTT client
Click to show internal directories.
Click to hide internal directories.