mqtt

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidTopicFilter ...
	ErrInvalidTopicFilter = errors.New("invalid topic filter")
	// ErrInvalidQos ...
	ErrInvalidQos = errors.New("invalid Qos")
	// ErrInvalidUtf8String ...
	ErrInvalidUtf8String = errors.New("invalid utf-8 string")
)

Functions

This section is empty.

Types

type GMqttServer

type GMqttServer interface {
	Run() error
	Stop(ctx context.Context) error
	Init(opts ...server.Options) error
	// SubscriptionStore returns the subscription.Store.
	SubscriptionService() server.SubscriptionService
	// RetainedStore returns the retained.Store.
	RetainedStore() retained.Store
	// Publisher returns the Publisher
	Publisher() server.Publisher
	// client return the ClientService
	ClientService() server.ClientService
	// GetConfig returns the config of the server
	GetConfig() config.Config
	// StatsManager returns StatsReader
	StatsManager() server.StatsReader
}

GMqttServer ...

type Message

type Message struct {
	Dup      bool
	Qos      uint8
	Retained bool
	Topic    string
	PacketID uint16
	Payload  []byte
}

Message ...

type MessageHandler

type MessageHandler func(MqttCli, Message)

MessageHandler ...

type MqttAuthenticator

type MqttAuthenticator interface {
	Authenticate(login string, pass interface{}) (err error)
	//DEPRECATED
	Register(fn func(login, password string) (err error)) (err error)
	//DEPRECATED
	Unregister(fn func(login, password string) (err error)) (err error)
}

MqttAuthenticator ...

type MqttCli

type MqttCli interface {
	Publish(topic string, payload []byte) error
	Subscribe(topic string, handler MessageHandler) error
	Unsubscribe(topic string)
	UnsubscribeAll()
	OnMsgArrived(ctx context.Context, client server.Client, req *server.MsgArrivedRequest)
}

MqttCli ...

type MqttServ

type MqttServ interface {
	Shutdown() error
	Start()
	Publish(topic string, payload []byte, qos uint8, retain bool) error
	NewClient(name string) MqttCli
	RemoveClient(name string)
	Authenticator() MqttAuthenticator
}

MqttServ ...

Jump to

Keyboard shortcuts

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