iot: github.com/vaelen/iot/paho Index | Files

package paho

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.

Index

Package Files

paho.go

func NewClient Uses

func NewClient(thing iot.Thing, options *iot.ThingOptions) iot.MQTTClient

NewClient creates an MQTTClient instance using Eclipse Paho.

type MQTTClient Uses

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.

func (*MQTTClient) Connect Uses

func (c *MQTTClient) Connect(ctx context.Context, servers ...string) error

Connect should connect to the given MQTT server

func (*MQTTClient) Disconnect Uses

func (c *MQTTClient) Disconnect(ctx context.Context) error

Disconnect will disconnect from the given MQTT server and clean up all client resources

func (*MQTTClient) IsConnected Uses

func (c *MQTTClient) IsConnected() bool

IsConnected should return true when the client is connected to the server

func (*MQTTClient) Publish Uses

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 (*MQTTClient) SetClientID Uses

func (c *MQTTClient) SetClientID(clientID string)

SetClientID sets the MQTT client id

func (*MQTTClient) SetCredentialsProvider Uses

func (c *MQTTClient) SetCredentialsProvider(credentialsProvider iot.MQTTCredentialsProvider)

SetCredentialsProvider sets the CredentialsProvider used by the MQTT client

func (*MQTTClient) SetDebugLogger Uses

func (c *MQTTClient) SetDebugLogger(logger iot.Logger)

SetDebugLogger sets the logger to use for logging debug messages

func (*MQTTClient) SetErrorLogger Uses

func (c *MQTTClient) SetErrorLogger(logger iot.Logger)

SetErrorLogger sets the logger to use for logging error or critical messages

func (*MQTTClient) SetInfoLogger Uses

func (c *MQTTClient) SetInfoLogger(logger iot.Logger)

SetInfoLogger sets the logger to use for logging information or warning messages

func (*MQTTClient) SetOnConnectHandler Uses

func (c *MQTTClient) SetOnConnectHandler(handler iot.MQTTOnConnectHandler)

SetOnConnectHandler sets the method that is called after the client connects to the server

func (*MQTTClient) Subscribe Uses

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

func (*MQTTClient) Unsubscribe Uses

func (c *MQTTClient) Unsubscribe(ctx context.Context, topic string) error

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.