mqtt

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractData

func ExtractData(payload []byte) (string, senml.Pack, error)

ExtractData extracts/parse the data from the MQTT message.

Types

type AuthenticatedMsg

type AuthenticatedMsg struct {
	Token   string `json:"token"`
	Records []senml.Record
}

type Authorizer

type Authorizer func(topic string, jwt string) error

func CreateAuthorizer

func CreateAuthorizer(auth authClient.Auth, cache cdb.ThingCache) (Authorizer, error)

CreateAuthorizer creates an authorizer function that can be used to authorize a mqtt topic

type Conf

type Conf struct {
	User       string
	Pass       string
	Host       string
	Port       string
	HealthPort string
}

type MqttSub

type MqttSub interface {
	Connect() error
	Subscriber(topic string, qos byte, authorizer Authorizer, handler nats.NatsPubType) error
	Unsubscribe(topic string)
	Disconnect()
}

func New

func New(config Conf) MqttSub

Jump to

Keyboard shortcuts

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