mqtt

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ParamAccuracy string = "acc"

ParamAccuracy is the key for the parameter "accuracy"

View Source
const ParamAltitude string = "alt"

ParamAltitude is the key for the parameter "altitude"

View Source
const ParamLatitude string = "lat"

ParamLatitude is the key for the parameter "latitude"

View Source
const ParamLongitude string = "lon"

ParamLongitude is the key for the parameter "longitude"

View Source
const ParamTime string = "tst"

ParamTime is the key for the parameter "time"

View Source
const ParamTrigger string = "t"

ParamTrigger is the key for the parameter "trigger"

View Source
const ParamType string = "_type"

ParamType is the key for the parameter "type"

View Source
const ParamVelocity string = "vel"

ParamVelocity is the key for the parameter "velocity"

View Source
const TriggerManual string = "u"

TriggerManual is a value for the parameter "trigger". It means that the location has been sent by the user manually.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Messages chan Message
	// contains filtered or unexported fields
}

Client provides an mqtt client

func New

func New(config Config) *Client

New returns an instance of an mqtt client

func (*Client) Connect

func (t *Client) Connect()

Connect connects to mqtt broker using the given config

func (*Client) Disconnect

func (t *Client) Disconnect()

Disconnect closes the Messages channel and disconnects the mqtt client

type Config

type Config struct {
	Host        string
	Port        int
	Topic       string
	User        string
	Password    string
	IsTLS       bool
	IsAnonymous bool
}

Config holds configuration for MqttClient

type Message

type Message struct {
	Topic string
	Body  map[string]interface{}
}

Message is an MQTT message consisting of a topic and a body (map)

Jump to

Keyboard shortcuts

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