Documentation ¶
Index ¶
- func New(opt *Options, logger *zap.SugaredLogger)
- func Publish(topic string, qos QOS, retain bool, payload []byte) error
- func RegisterMultipleSubscriber(topics map[string]byte, callback mqtt.MessageHandler)
- func RegisterSubscriber(topic string, qos QOS, handler mqtt.MessageHandler)
- func ServerConnect()
- func ServerDisconnect(quiesce uint)
- func Unsubscribe(topic string)
- type Mqc
- type Options
- type QOS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opt *Options, logger *zap.SugaredLogger)
func RegisterMultipleSubscriber ¶
func RegisterMultipleSubscriber(topics map[string]byte, callback mqtt.MessageHandler)
func RegisterSubscriber ¶
func RegisterSubscriber(topic string, qos QOS, handler mqtt.MessageHandler)
func ServerConnect ¶
func ServerConnect()
ServerConnect will create a connection to the message broker, by default
func ServerDisconnect ¶
func ServerDisconnect(quiesce uint)
ServerDisconnect Disconnect will end the connection with the server, but not before waiting the specified number of milliseconds to wait for existing work to be completed.
func Unsubscribe ¶
func Unsubscribe(topic string)
Types ¶
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func NewOptions ¶
func (*Options) SetConnectRetry ¶
func (*Options) SetConnectTimeout ¶
type QOS ¶
type QOS byte
QOS describes the quality of service of an mqtt publish
const ( // AtMostOnce means the broker will deliver at most once to every subscriber - this means message delivery is not guaranteed AtMostOnce QOS = iota // AtLeastOnce means the broker will deliver a message at least once to every subscriber AtLeastOnce // ExactlyOnce means the broker will deliver a message exactly once to every subscriber ExactlyOnce )
Click to show internal directories.
Click to hide internal directories.