mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-24 14:31:47 +01:00
Bumps [github.com/eclipse/paho.mqtt.golang](https://github.com/eclipse/paho.mqtt.golang) from 1.5.0 to 1.5.1. - [Release notes](https://github.com/eclipse/paho.mqtt.golang/releases) - [Commits](https://github.com/eclipse/paho.mqtt.golang/compare/v1.5.0...v1.5.1) --- updated-dependencies: - dependency-name: github.com/eclipse/paho.mqtt.golang dependency-version: 1.5.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
80 lines
1.6 KiB
Go
80 lines
1.6 KiB
Go
package mqtt
|
|
|
|
import "net/url"
|
|
|
|
type ConnectionNotificationType int64
|
|
|
|
const (
|
|
ConnectionNotificationTypeConnected ConnectionNotificationType = iota
|
|
ConnectionNotificationTypeConnecting
|
|
ConnectionNotificationTypeFailed
|
|
ConnectionNotificationTypeLost
|
|
ConnectionNotificationTypeBroker
|
|
ConnectionNotificationTypeBrokerFailed
|
|
)
|
|
|
|
type ConnectionNotification interface {
|
|
Type() ConnectionNotificationType
|
|
}
|
|
|
|
// Connected
|
|
|
|
type ConnectionNotificationConnected struct {
|
|
}
|
|
|
|
func (n ConnectionNotificationConnected) Type() ConnectionNotificationType {
|
|
return ConnectionNotificationTypeConnected
|
|
}
|
|
|
|
// Connecting
|
|
|
|
type ConnectionNotificationConnecting struct {
|
|
IsReconnect bool
|
|
Attempt int
|
|
}
|
|
|
|
func (n ConnectionNotificationConnecting) Type() ConnectionNotificationType {
|
|
return ConnectionNotificationTypeConnecting
|
|
}
|
|
|
|
// Connection Failed
|
|
|
|
type ConnectionNotificationFailed struct {
|
|
Reason error
|
|
}
|
|
|
|
func (n ConnectionNotificationFailed) Type() ConnectionNotificationType {
|
|
return ConnectionNotificationTypeFailed
|
|
}
|
|
|
|
// Connection Lost
|
|
|
|
type ConnectionNotificationLost struct {
|
|
Reason error // may be nil
|
|
}
|
|
|
|
func (n ConnectionNotificationLost) Type() ConnectionNotificationType {
|
|
return ConnectionNotificationTypeLost
|
|
}
|
|
|
|
// Broker Connection
|
|
|
|
type ConnectionNotificationBroker struct {
|
|
Broker *url.URL
|
|
}
|
|
|
|
func (n ConnectionNotificationBroker) Type() ConnectionNotificationType {
|
|
return ConnectionNotificationTypeBroker
|
|
}
|
|
|
|
// Broker Connection Failed
|
|
|
|
type ConnectionNotificationBrokerFailed struct {
|
|
Broker *url.URL
|
|
Reason error
|
|
}
|
|
|
|
func (n ConnectionNotificationBrokerFailed) Type() ConnectionNotificationType {
|
|
return ConnectionNotificationTypeBrokerFailed
|
|
}
|