mqtt

package
v0.0.0-...-4351fdd Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFromSourceConfig

func NewFromSourceConfig(g config.Generic) (s api.Source, err error)

NewFromSourceConfig creates MQTT data source

func NewFromTargetConfig

func NewFromTargetConfig(g config.Generic) (t api.Target, err error)

NewFromTargetConfig creates MQTT data target

func NewMqttClientOptions

func NewMqttClientOptions(url string, user string, password string) *mqtt.ClientOptions

func ServerFromClient

func ServerFromClient(client mqtt.Client) string

func StripTrailingSlash

func StripTrailingSlash(s string) string

Types

type Connector

type Connector struct {
	MqttClient mqtt.Client
}

func (*Connector) Connect

func (m *Connector) Connect(mqttClient mqtt.Client)

func (*Connector) WaitForToken

func (m *Connector) WaitForToken(token mqtt.Token, timeout time.Duration) bool

WaitForToken returns if an mqtt operation finished within timespan

type Publisher

type Publisher struct {
	*Connector
	// contains filtered or unexported fields
}

Publisher is the MQTT data target

func NewPublisher

func NewPublisher(name string, topic string, mqttOptions *mqtt.ClientOptions) *Publisher

NewPublisher creates MQTT data target

func (*Publisher) Publish

func (h *Publisher) Publish(d api.Data)

Publish implements api.Source

type Subscriber

type Subscriber struct {
	*Connector
	// contains filtered or unexported fields
}

Subscriber is the MQTT data source

func NewSubscriber

func NewSubscriber(name string, rootTopic string, mqttOptions *mqtt.ClientOptions) *Subscriber

NewSubscriber creates MQTT data source

func (*Subscriber) Run

func (h *Subscriber) Run(out chan api.Data)

Run implements api.Source

Jump to

Keyboard shortcuts

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