mqttx

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitClient added in v1.1.28

func InitClient(opt *MQTTOptions)

Types

type ConnectHandler added in v1.1.28

type ConnectHandler func(mqtt.Client)

type ConnectLostHandler added in v1.1.28

type ConnectLostHandler func(mqtt.Client, error)

type Context added in v1.1.28

type Context struct {
	URI     string
	Topic   string
	Buffer  []byte
	Message string
}

type Engine added in v1.1.28

type Engine struct {
	Topic    string
	TopicLen int
	Wildcard bool
	Shared   bool

	BeforeHook []HookHandler
	AfterHook  []HookHandler
	// contains filtered or unexported fields
}

func NewEngine added in v1.1.28

func NewEngine(topic string, wildcard bool) (eng Engine)

func (*Engine) Register added in v1.1.28

func (e *Engine) Register(url string, handler HandlerFunc)

func (*Engine) UseAfter added in v1.1.28

func (e *Engine) UseAfter(handler ...HookHandler)

func (*Engine) UseBefore added in v1.1.28

func (e *Engine) UseBefore(handler ...HookHandler)

type HandlerFunc added in v1.1.28

type HandlerFunc func(*Context)

type HookHandler added in v1.1.28

type HookHandler func(*Context)

type MQTT added in v1.1.28

type MQTT struct {
	// contains filtered or unexported fields
}

func GetConnect added in v1.1.28

func GetConnect() *MQTT

get

func (*MQTT) Connect added in v1.1.28

func (c *MQTT) Connect() error

func (*MQTT) Publish added in v1.1.28

func (c *MQTT) Publish(topic string, data []byte) error

type MQTTOptions added in v1.1.28

type MQTTOptions struct {
	Addr               string
	ID                 string
	Username           string
	Password           string
	KeepAlive          time.Duration
	SetPingTimeout     time.Duration
	Engine             []Engine
	ConnectHandler     ConnectHandler
	ConnectLostHandler ConnectLostHandler
}

func Default added in v1.1.28

func Default(addr, id, username, password string) *MQTTOptions

func (*MQTTOptions) Register added in v1.1.28

func (m *MQTTOptions) Register(engine ...Engine)

type PublishHook added in v1.1.28

type PublishHook func()

Jump to

Keyboard shortcuts

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