Documentation ¶
Index ¶
- Variables
- func Destroy(client *Client)
- type Client
- func (client *Client) Publish(topic string, qos byte, retained bool, payload any) error
- func (client *Client) PublishAndReceiveReply(params *PublishAndReceiveReplyParams, ...) error
- func (client *Client) PublishAndReceiveReplyMsgResponse(params *PublishAndReceiveReplyParams) error
- func (client *Client) Subscribe(topic string, handlerFunc MessageHandler) (*SubscribeToken, error)
- func (client *Client) Unsubscribe(topic string, token *SubscribeToken) error
- type ClientOptions
- type MessageHandler
- type PublishAndReceiveReplyParams
- type SubscribeToken
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMessageIgnore = errors.New("mqtt消息忽略")
)
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts *ClientOptions) (*Client, error)
func (*Client) PublishAndReceiveReply ¶
func (client *Client) PublishAndReceiveReply(params *PublishAndReceiveReplyParams, payloadDealFunc func(payload []byte) error) error
func (*Client) PublishAndReceiveReplyMsgResponse ¶
func (client *Client) PublishAndReceiveReplyMsgResponse(params *PublishAndReceiveReplyParams) error
func (*Client) Subscribe ¶
func (client *Client) Subscribe(topic string, handlerFunc MessageHandler) (*SubscribeToken, error)
func (*Client) Unsubscribe ¶
func (client *Client) Unsubscribe(topic string, token *SubscribeToken) error
type ClientOptions ¶
type MessageHandler ¶
type MessageHandler func(client *Client, token *SubscribeToken, topic string, data []byte) error
type PublishAndReceiveReplyParams ¶
type PublishAndReceiveReplyParams struct { Topic string ReplyTopic string PublishData []byte RepublishDurationSec int64 TryTimes int StopBefore bool }
func (*PublishAndReceiveReplyParams) Check ¶
func (params *PublishAndReceiveReplyParams) Check() error
type SubscribeToken ¶
type SubscribeToken struct {
// contains filtered or unexported fields
}
func (*SubscribeToken) HandleCount ¶
func (token *SubscribeToken) HandleCount() int
func (*SubscribeToken) SuccessHandleCount ¶
func (token *SubscribeToken) SuccessHandleCount() int
Click to show internal directories.
Click to hide internal directories.