mqtt

package
v0.0.0-...-87a4583 Latest Latest
Warning

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

Go to latest
Published: May 25, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package mqtt implements reusable logic for mqtt connections for tempus edge applications.

Security and mqtt client connectivity is implemented here, but application logic is left to the package of specific tempus edge applications.

Index

Constants

This section is empty.

Variables

View Source
var Inbox chan *proto.MqttMessage

Inbox holds incoming mqtt messages from the broker

View Source
var Outbox chan *proto.MqttMessage

Outbox holds outgoing mqtt messages to the broker

Functions

func Init

func Init(inboxSize, outboxSize int)

Init does the following: - creates Inbox and Outbox channels - starts a go routine for draining the Outbox

@param inboxSize - int size of the Inbox channel @param outboxSize - int size of the Outbox channel

func PublishJSONDataMessage

func PublishJSONDataMessage(msg *proto.JsonDataMessage) error

PublishJSONDataMessage converts msg into an MqttMessage and pushes it to the outbox channel

@param msg - pointer to the JsonDataMessage to parse and send to the broker

func PublishJSONString

func PublishJSONString(json []byte)

PublishJSONString converts msg into an MqttMessage and pushes it to the outbox channel

@param json - byte slice to parse and send to the broker

func PublishMQTTMessage

func PublishMQTTMessage(msg *proto.MqttMessage) (err error)

PublishMQTTMessage pushes msg to the outbox channel for processing

@param msg - pointer to the MqttMessage to send to the broker

func PublishOPCMessage

func PublishOPCMessage(msg *proto.OpcMessage) error

PublishOPCMessage converts msg into an MqttMessage and pushes it to the outbox channel

@param msg - pointer to the OpcMessage to parse and send to the broker

func Update

func Update(mqttConfig *proto.MqttConfig) error

Update does the following: - converts the given mqttConfig into a paho mqtt client options struct - closes the current client connection - starts a new client connection with the new client options

@param mqttConfig - MqttConfig proto struct containing mqtt client configs

Types

This section is empty.

Jump to

Keyboard shortcuts

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