mqtt

package
v0.0.0-...-b463ae7 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMQTTClient

func NewMQTTClient(
	ctx context.Context,
	handleCmd types.AgentCmdHandleFunc,
	cfg interface{},
) (_ client.Interface, err error)

Types

type Client

type Client struct {
	*clientutil.BaseClient
	// contains filtered or unexported fields
}

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect(dialCtx context.Context) error

func (*Client) PostMsg

func (c *Client) PostMsg(msg *aranyagopb.Msg) error

func (*Client) Start

func (c *Client) Start(ctx context.Context) error

type Config

type Config struct {
	clientutil.CommonConfig `json:",inline" yaml:",inline"`

	Version            string             `json:"version" yaml:"version"`
	Variant            string             `json:"variant" yaml:"variant"`
	Transport          string             `json:"transport" yaml:"transport"`
	TopicNamespaceFrom conf.ValueFromSpec `json:"topicNamespaceFrom" yaml:"topicNamespaceFrom"`
	ClientID           string             `json:"clientID" yaml:"clientID"`
	Username           string             `json:"username" yaml:"username"`
	Password           string             `json:"password" yaml:"password"`
	KeepaliveInterval  time.Duration      `json:"keepaliveInterval" yaml:"keepaliveInterval"`
}

func (*Config) GetConnectInfo

func (c *Config) GetConnectInfo() (*ConfigConnectInfo, error)

type ConfigConnectInfo

type ConfigConnectInfo struct {
	Username string
	Password string
	ClientID string

	MsgPubTopic       string
	CmdSubTopic       string
	CmdSubTopicHandle string
	WillPubTopic      string
	SupportRetain     bool

	MaxPayloadSize int
	TLSConfig      *tls.Config

	TopicRouter libmqtt.TopicRouter
}

Jump to

Keyboard shortcuts

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