client

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateId

func CreateId(sign string) string

func CreateShortId

func CreateShortId(port string) string

func Disconnect

func Disconnect()

func GetClient

func GetClient() mqtt.Client

func GetConnectToken

func GetConnectToken() mqtt.Token

func New

func New(opt Options) (mqtt.Client, error)

func Publish

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

平台发送命令到物联网设备的MQTT消息

Types

type Events

type Events struct {
	PublishHandler        func(client mqtt.Client, msg mqtt.Message, options Options)
	ConnectHandler        func(client mqtt.Client, options Options)
	ConnectionLostHandler func(client mqtt.Client, err error, options Options)
}

func (*Events) Default

func (evs *Events) Default() *Events

type Options

type Options struct {
	Server            string
	SSLInfo           config.SSLInfo
	ClientId          string
	Events            Events
	DisconnectQuiesce uint
	AutoReconnect     bool
}

Jump to

Keyboard shortcuts

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