paho

package
v0.0.0-...-4859fc7 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package paho provides an iot.MQTTClient implementation that uses the Eclipse Paho MQTT client. To use the client, you must import this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

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

NewClient creates an MQTTClient instance using Eclipse Paho.

Types

type MQTTClient

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

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

Connect should connect to the given MQTT server

func (*MQTTClient) Disconnect

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

func (c *MQTTClient) IsConnected() bool

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

func (*MQTTClient) Publish

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

func (c *MQTTClient) SetClientID(clientID string)

SetClientID sets the MQTT client id

func (*MQTTClient) SetCredentialsProvider

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

SetCredentialsProvider sets the CredentialsProvider used by the MQTT client

func (*MQTTClient) SetDebugLogger

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

SetDebugLogger sets the logger to use for logging debug messages

func (*MQTTClient) SetErrorLogger

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

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

func (*MQTTClient) SetInfoLogger

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

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

func (*MQTTClient) SetOnConnectHandler

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

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

func (*MQTTClient) Subscribe

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

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

Unsubscribe will unsubscribe from the given topic

Jump to

Keyboard shortcuts

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