Documentation
¶
Index ¶
- func GetClient(opts *gomqtt.ClientOptions) (client gomqtt.Client, err error)
- func GetClientOptions(conf *Config) *gomqtt.ClientOptions
- func Init(opts *gomqtt.ClientOptions) (err error)
- func Publish(topic string, payload interface{}, qos byte, retained bool) (err error)
- func Subscribe(item SubscribeType)
- type Config
- type SubscribeType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClient ¶
func GetClient(opts *gomqtt.ClientOptions) (client gomqtt.Client, err error)
获取MQTT连接
Types ¶
type Config ¶
type Config struct {
Host string `json:"Host"` // Broker地址
Port int `json:"Port"` // Broker端口号
ClientID string `json:"ClientID"` // ClientID
}
MQTT的配置信息格式
type SubscribeType ¶
type SubscribeType struct {
Topic string
Qos byte
Callback gomqtt.MessageHandler
RetryTimes int // 为0表示无限重试
}
Click to show internal directories.
Click to hide internal directories.