mqttx

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Username string `json:"username,optional"`
	Password string `json:"password,optional"`
	ClientId string `json:"clientId,optional"`
}

type MqtMsg

type MqtMsg struct {
	Topic     string
	Duplicate bool
	Qos       byte
	Retained  bool
	MessageID uint16
	Payload   []byte
	Ack       func()
}

type MqttX

type MqttX struct {
	Conf   Conf
	Client mqtt.Client
	// contains filtered or unexported fields
}

func Create

func Create(conf Conf,
	defaultPublishHandler MsgHandler,
	onConnectHandler OnConnectHandler,
	onConnectionLostHandler OnConnectionLostHandler,
) (*MqttX, error)

func QuickCreate

func QuickCreate(conf Conf) (*MqttX, error)

func (*MqttX) Disconnect

func (mx *MqttX) Disconnect(quiesce uint)

func (*MqttX) Publish

func (mx *MqttX) Publish(msg MqtMsg)

func (*MqttX) Subscribe

func (mx *MqttX) Subscribe(msg MqtMsg, callback MsgHandler)

func (*MqttX) Unsubscribe

func (mx *MqttX) Unsubscribe(topics ...string) error

type MsgHandler

type MsgHandler func(MqtMsg)

type OnConnectHandler

type OnConnectHandler func()

type OnConnectionLostHandler

type OnConnectionLostHandler func(error)

Jump to

Keyboard shortcuts

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