mqtt_client

package
v0.0.0-...-ebfecad Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AtMostOnce  = byte(0)
	AtLeastOnce = byte(1)
	ExactlyOnce = byte(2)
)

Variables

View Source
var GMQTestHost string
View Source
var GMQTestMode = false
View Source
var LibMQTTTestHost string
View Source
var LibMQTTTestMode = false
View Source
var PahoTestHost string
View Source
var PahoTestMode = false

Functions

func EnableGMQTestMode

func EnableGMQTestMode(host string)

func EnableLibMQTTTestMode

func EnableLibMQTTTestMode(host string)

func EnablePahoTestMode

func EnablePahoTestMode(host string)

Types

type Client

type Client interface {
	Connect() error
	Publish(topic string, qos byte, retained bool, payload interface{}, quiet ...bool) error
	Subscribe(topic string, qos byte, callback func(message Message)) error
	Unsubscribe(topic string) error
	Disconnect() error
}

func GetGMQClient

func GetGMQClient(host, username, password string, errorHandler func(Client, error)) (client Client)

func GetGlueClient

func GetGlueClient(host, username, password string, errorHandler func(Client, error)) (client Client)

func GetLibMQTTClient

func GetLibMQTTClient(host, username, password string, errorHandler func(Client, error)) (client Client)

func GetMQTTClient

func GetMQTTClient(host, username, password string) (client Client)

func GetPahoClient

func GetPahoClient(host, username, password string, errorHandler func(Client, error)) (client Client)

type GMQClient

type GMQClient struct {
	// contains filtered or unexported fields
}

func NewGMQClient

func NewGMQClient(host, username, password string, errorHandler func(Client, error)) (c *GMQClient)

func (*GMQClient) Connect

func (c *GMQClient) Connect() error

func (*GMQClient) Disconnect

func (c *GMQClient) Disconnect() error

func (*GMQClient) Publish

func (c *GMQClient) Publish(topic string, qos byte, retained bool, payload interface{}, quiet ...bool) error

func (*GMQClient) Subscribe

func (c *GMQClient) Subscribe(topic string, qos byte, callback func(message Message)) error

func (*GMQClient) Unsubscribe

func (c *GMQClient) Unsubscribe(topic string) error

type GlueClient

type GlueClient struct {
	// contains filtered or unexported fields
}

func NewGlueClient

func NewGlueClient(host, username, password string, errorHandler func(Client, error)) (*GlueClient, error)

func (*GlueClient) Connect

func (c *GlueClient) Connect() error

func (*GlueClient) Disconnect

func (c *GlueClient) Disconnect() error

func (*GlueClient) Publish

func (c *GlueClient) Publish(topic string, qos byte, retained bool, payload interface{}, quiet ...bool) error

func (*GlueClient) Subscribe

func (c *GlueClient) Subscribe(topic string, qos byte, callback func(message Message)) error

func (*GlueClient) Unsubscribe

func (c *GlueClient) Unsubscribe(topic string) error

type LibMQTTClient

type LibMQTTClient struct {
	// contains filtered or unexported fields
}

func NewLibMQTTClient

func NewLibMQTTClient(host, username, password string, errorHandler func(Client, error)) (c *LibMQTTClient)

func (*LibMQTTClient) Connect

func (c *LibMQTTClient) Connect() error

func (*LibMQTTClient) Disconnect

func (c *LibMQTTClient) Disconnect() error

func (*LibMQTTClient) Publish

func (c *LibMQTTClient) Publish(topic string, qos byte, retained bool, payload interface{}, quiet ...bool) error

func (*LibMQTTClient) Subscribe

func (c *LibMQTTClient) Subscribe(topic string, qos byte, callback func(message Message)) error

func (*LibMQTTClient) Unsubscribe

func (c *LibMQTTClient) Unsubscribe(topic string) error

type Message

type Message struct {
	Received  time.Time
	Topic     string
	MessageID uint16
	Payload   string
}

func (*Message) MostlyEqual

func (m *Message) MostlyEqual(other *Message) bool

type PahoClient

type PahoClient struct {
	// contains filtered or unexported fields
}

func NewPahoClient

func NewPahoClient(host, username, password string, errorHandler func(Client, error)) (c *PahoClient)

func (*PahoClient) Connect

func (c *PahoClient) Connect() error

func (*PahoClient) Disconnect

func (c *PahoClient) Disconnect() error

func (*PahoClient) Publish

func (c *PahoClient) Publish(topic string, qos byte, retained bool, payload interface{}, quiet ...bool) error

func (*PahoClient) Subscribe

func (c *PahoClient) Subscribe(topic string, qos byte, callback func(message Message)) error

func (*PahoClient) Unsubscribe

func (c *PahoClient) Unsubscribe(topic string) error

type PersistentClient

type PersistentClient struct {
	// contains filtered or unexported fields
}

func NewPersistentClient

func NewPersistentClient() *PersistentClient

func (*PersistentClient) Connect

func (c *PersistentClient) Connect() error

func (*PersistentClient) Disconnect

func (c *PersistentClient) Disconnect() error

func (*PersistentClient) HandleError

func (c *PersistentClient) HandleError(client Client, err error)

func (*PersistentClient) Publish

func (c *PersistentClient) Publish(topic string, qos byte, retained bool, payload interface{}, quiet ...bool) error

func (*PersistentClient) SetClient

func (c *PersistentClient) SetClient(client Client)

func (*PersistentClient) Subscribe

func (c *PersistentClient) Subscribe(topic string, qos byte, callback func(message Message)) error

func (*PersistentClient) Unsubscribe

func (c *PersistentClient) Unsubscribe(topic string) error

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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