mqtt

package
v0.0.0-...-750a8a5 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

func Init

func Init(c Config)

func Publish

func Publish(topic string, qos byte, retained bool, data []byte) error

发布

func Subscribe

func Subscribe(onMessage mqtt.MessageHandler, qos byte, topics ...string) error

订阅

Types

type Config

type Config struct {
	Broker    string `json:"broker" yaml:"broker"`
	ClientID  string `json:"client_id" yaml:"client_id" mapstructure:"client_id"`
	KeepAlive int64  `json:"keep_alive" yaml:"keep_alive" mapstructure:"keep_alive"`
}

type Message

type Message struct {
	ClientID string      `json:"client_id"`
	Data     interface{} `json:"data"`
	Time     int64       `json:"time"`
}

Jump to

Keyboard shortcuts

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