import "github.com/vaelen/iot/paho"
Package paho provides an iot.MQTTClient implementation that uses the Eclipse Paho MQTT client. To use the client, you must import this package.
func NewClient(thing iot.Thing, options *iot.ThingOptions) iot.MQTTClient
NewClient creates an MQTTClient instance using Eclipse Paho.
type MQTTClient struct {
// contains filtered or unexported fields
}
MQTTClient is an implementation of MQTTClient that uses Eclipse Paho. To use the client, you must include this package.
Connect should connect to the given MQTT server
func (c *MQTTClient) Disconnect(ctx context.Context) error
Disconnect will disconnect from the given MQTT server and clean up all client resources
func (c *MQTTClient) IsConnected() bool
IsConnected should return true when the client is connected to the server
func (c *MQTTClient) Publish(ctx context.Context, topic string, qos uint8, payload interface{}) error
Publish will publish the given payload to the given topic with the given quality of service level
func (c *MQTTClient) SetClientID(clientID string)
SetClientID sets the MQTT client id
func (c *MQTTClient) SetCredentialsProvider(credentialsProvider iot.MQTTCredentialsProvider)
SetCredentialsProvider sets the CredentialsProvider used by the MQTT client
func (c *MQTTClient) SetDebugLogger(logger iot.Logger)
SetDebugLogger sets the logger to use for logging debug messages
func (c *MQTTClient) SetErrorLogger(logger iot.Logger)
SetErrorLogger sets the logger to use for logging error or critical messages
func (c *MQTTClient) SetInfoLogger(logger iot.Logger)
SetInfoLogger sets the logger to use for logging information or warning messages
func (c *MQTTClient) SetOnConnectHandler(handler iot.MQTTOnConnectHandler)
SetOnConnectHandler sets the method that is called after the client connects to the server
func (c *MQTTClient) Subscribe(ctx context.Context, topic string, qos uint8, callback iot.ConfigHandler) error
Subscribe will subscribe to the given topic with the given quality of service level and message handler
Unsubscribe will unsubscribe from the given topic
Package paho imports 6 packages (graph) and is imported by 1 packages. Updated 2019-10-28. Refresh now. Tools for package owners.