mqtt

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: GPL-3.0 Imports: 26 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 Admin added in v0.5.0

type Admin interface {
	GetClients(limit, offset uint) (list []*admin.ClientInfo, total uint32, err error)
	GetClient(clientId string) (client *admin.ClientInfo, err error)
	GetSessions(limit, offset uint) (list []*admin.SessionInfo, total int, err error)
	GetSession(clientId string) (session *admin.SessionInfo, err error)
	GetSubscriptions(clientId string, limit, offset uint) (list []*admin.SubscriptionInfo, total int, err error)
	Subscribe(clientId, topic string, qos int) (err error)
	Unsubscribe(clientId, topic string) (err error)
	Publish(topic string, qos int, payload []byte, retain bool) (err error)
	CloseClient(clientId string) (err error)
	SearchTopic(query string) (result []*admin.SubscriptionInfo, err error)
}

Admin ...

type Config added in v0.5.0

type Config struct {
	Port                       int
	RetryInterval              time.Duration
	RetryCheckInterval         time.Duration
	SessionExpiryInterval      time.Duration
	SessionExpireCheckInterval time.Duration
	QueueQos0Messages          bool
	MaxInflight                int
	MaxAwaitRel                int
	MaxMsgQueue                int
	Logging                    bool
	DebugMode                  common.RunMode
}

Config ...

type GMqttServer added in v0.5.0

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 added in v0.2.0

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

Message ...

type MessageHandler added in v0.2.0

type MessageHandler func(MqttCli, Message)

MessageHandler ...

type Mqtt

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

Mqtt ...

func (*Mqtt) Admin added in v0.5.0

func (m *Mqtt) Admin() Admin

Admin ...

func (*Mqtt) Authenticator added in v0.5.0

func (m *Mqtt) Authenticator() mqtt_authenticator.MqttAuthenticator

Authenticator ...

func (*Mqtt) NewClient

func (m *Mqtt) NewClient(name string) (client MqttCli)

NewClient ...

func (*Mqtt) Publish added in v0.0.25

func (m *Mqtt) Publish(topic string, payload []byte, qos uint8, retain bool) (err error)

Publish ...

func (*Mqtt) RemoveClient added in v0.5.0

func (m *Mqtt) RemoveClient(name string)

RemoveClient ...

func (*Mqtt) Shutdown

func (m *Mqtt) Shutdown() (err error)

Shutdown ...

func (*Mqtt) Start added in v0.5.0

func (m *Mqtt) Start()

Start ...

type MqttBind added in v0.0.19

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

MqttBind ...

func NewMqttBind added in v0.0.19

func NewMqttBind(mqtt MqttServ) *MqttBind

NewMqttBind ...

func (MqttBind) Publish added in v0.0.19

func (m MqttBind) Publish(topic string, payload []byte, qos uint8, retain bool)

Publish ...

type MqttCli added in v0.5.0

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 ...

func NewClient

func NewClient(mqtt *Mqtt, name string) MqttCli

NewClient ...

type MqttServ added in v0.5.0

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

MqttServ ...

func NewMqtt

func NewMqtt(lc fx.Lifecycle,
	cfg *Config,
	authenticator mqtt_authenticator.MqttAuthenticator,
	scriptService scripts.ScriptService,
	eventBus bus.Bus) (mqtt MqttServ)

NewMqtt ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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