Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) Close()
- func (c *Client) DefaultOnConnectFunc(cli mqtt.Client)
- func (c *Client) OnConnectListener(fun mqtt.OnConnectHandler) (mc *Client)
- func (c *Client) OnConnectLostListener(fun mqtt.ConnectionLostHandler) (mc *Client)
- func (c *Client) Publish(topic string, qos QosType, payload interface{}) error
- func (c *Client) StartAndConnect() (err error)
- func (c *Client) Subscribe(topic string, qos QosType, callback mqtt.MessageHandler) error
- func (c *Client) UnSubscribe(topics ...string) error
- type Config
- type QosType
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotExists = errors.New("mqtt not exists") ErrLostConnect = errors.New("mqtt connection lost") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Ops *mqtt.ClientOptions Mqtt mqtt.Client SubFuncs map[string]mqtt.MessageHandler // key:topic#qos, value: callback func // contains filtered or unexported fields }
func (*Client) DefaultOnConnectFunc ¶
func (c *Client) DefaultOnConnectFunc(cli mqtt.Client)
func (*Client) OnConnectListener ¶
OnConnectListener 2、设置链接监听
func (*Client) OnConnectLostListener ¶
OnConnectLostListener 3、设置断开链接监听
func (*Client) StartAndConnect ¶
StartAndConnect 4、真实创建Client并连接mqtt
func (*Client) UnSubscribe ¶
UnSubscribe 取消订阅topic
Click to show internal directories.
Click to hide internal directories.