mqtt

package
v0.0.0-...-c205787 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MaximumClientID = 1024

MaximumClientID represents maximum client identification of MQTT

Variables

This section is empty.

Functions

func Handler

func Handler(p protocol.Protocol, ch chan<- types.Data) paho.MessageHandler

Handler generates specific handler for each protocol

Types

type Service

type Service struct {
	IsRun bool
	// contains filtered or unexported fields
}

func New

func New(cfg config.MQTT) *Service

New creates a new MQTT service instance. MQTT service receives messages from protocols and publish them on its channel

func (*Service) Channel

func (s *Service) Channel() <-chan types.Data

Channel returns a channel for consuming the received data Consuming this channel makes MQTT service work

func (*Service) Exit

func (s *Service) Exit()

Exit closes MQTT connection then closes all channels and return from all pipeline stages

func (*Service) Protocols

func (s *Service) Protocols() []string

Protocols returns list of registered protocol's names

func (*Service) Register

func (s *Service) Register(p protocol.Protocol)

Register registers given protocol on MQTT service

func (*Service) Run

func (s *Service) Run() error

Run runs application. This function connects MQTT client and then register its topic

Jump to

Keyboard shortcuts

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