Documentation
¶
Index ¶
- func NewClient(cfg *Config, clientID string, ...) (mqtt.Client, error)
- func NewClientConnect(clientOptions *mqtt.ClientOptions) (mqtt.Client, error)
- func NewClientOptions(cfg *Config, clientID string) *mqtt.ClientOptions
- func SetLog(mqttLog Log)
- type Client
- type Config
- type Log
- type Message
- type RetryType
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(cfg *Config, clientID string, onConnects ...func(c mqtt.Client, retryTimes uint64) (RetryType, error)) (mqtt.Client, error)
NewClient 客户端 cannot re-subscribe on reconnect,即,假如有订阅 topic,在客户端断开连接时就会断开订阅,而重连时却不能自动重新订阅。 在 https://github.com/eclipse/paho.mqtt.golang/issues/22 提到了解决方案 认为在 OnConnect 中调用订阅,是简单可靠的方案
func NewClientConnect ¶
func NewClientConnect(clientOptions *mqtt.ClientOptions) (mqtt.Client, error)
func NewClientOptions ¶
func NewClientOptions(cfg *Config, clientID string) *mqtt.ClientOptions
Types ¶
Click to show internal directories.
Click to hide internal directories.