client

package
v2.0.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateConnection

func CreateConnection(ctx api.StreamContext, props map[string]any) (modules.Connection, error)

Types

type Connection

type Connection struct {
	pahoMqtt.Client
	// contains filtered or unexported fields
}

func CreateAnonymousConnection

func CreateAnonymousConnection(ctx api.StreamContext, props map[string]any) (*Connection, error)

func CreateClient

func CreateClient(ctx api.StreamContext, props map[string]any) (*Connection, error)

CreateClient creates a new mqtt client. It is anonymous and does not require a name.

func (*Connection) Close

func (conn *Connection) Close(ctx api.StreamContext) error

func (*Connection) DetachSub

func (conn *Connection) DetachSub(ctx api.StreamContext, props map[string]any)

Do not call this directly. Call connection pool Detach method to release the connection

func (*Connection) Ping

func (conn *Connection) Ping(ctx api.StreamContext) error

func (*Connection) Publish

func (conn *Connection) Publish(topic string, qos byte, retained bool, payload any) error

func (*Connection) Subscribe

func (conn *Connection) Subscribe(topic string, info *SubscriptionInfo) error

type ConnectionConfig

type ConnectionConfig struct {
	Server   string `json:"server"`
	PVersion string `json:"protocolVersion"`
	ClientId string `json:"clientid"`
	Uname    string `json:"username"`
	Password string `json:"password"`
	// contains filtered or unexported fields
}

func ValidateConfig

func ValidateConfig(props map[string]any) (*ConnectionConfig, error)

type SubscriptionInfo

type SubscriptionInfo struct {
	Qos        byte
	Handler    pahoMqtt.MessageHandler
	ErrHandler func(error)
}

Jump to

Keyboard shortcuts

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