Documentation ¶
Index ¶
Constants ¶
View Source
const ( SUBSCRIBE_STA_NOOK subscribeStaTp = 0 SUBSCRIBE_STA_OK subscribeStaTp = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConfigTp ¶
type ClientConfigTp struct { Broker string User string Password string Certificate string // 证书文件 PrivateKey string // 秘钥 ClientId string WillEnabled bool // 遗愿 WillTopic string // 遗愿主题 WillPayload string // 遗愿消息 WillQos byte // 遗愿服务质量 Qos byte // 服务质量 Retained bool // 保留消息 OnConnect MQTT.OnConnectHandler OnConnectionLost MQTT.ConnectionLostHandler KeepAlive int ReconnectSec int }
type MqttClient ¶
type MqttClient struct {
// contains filtered or unexported fields
}
func NewMqttClient ¶
func NewMqttClient(cfg ClientConfigTp) *MqttClient
func (*MqttClient) Close ¶
func (a *MqttClient) Close()
func (*MqttClient) Connect ¶
func (a *MqttClient) Connect()
func (*MqttClient) IsConnected ¶
func (a *MqttClient) IsConnected() bool
func (*MqttClient) Subscribe ¶
func (a *MqttClient) Subscribe(topic string, handler SubscribeHandler) error
type SubscribeHandler ¶
Click to show internal directories.
Click to hide internal directories.