Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backoff ¶ added in v0.7.0
type Backoff struct {
// contains filtered or unexported fields
}
Backoff implements a basic increasing backoff strategy with a small amount of random jitter
func NewBackoff ¶ added in v0.7.0
func NewBackoff() *Backoff
NewBackoff returns a freshly initialized Backoff
type Connection ¶ added in v0.7.0
type Connection interface { Connect(options ConnectionOptions) error Disconnect() error Publish(topic string, payload []byte) error Subscribe(topic string, handler SubscriptionHandler) error }
Connection is the high-level message bus interface
type ConnectionOptions ¶ added in v0.7.0
type ConnectionOptions struct { Userid string Password string Host string Port int SSLEnabled bool SSLCertPath string EventsHandler EventHandler AutoReconnect bool OnDisconnect *DisconnectMessage }
ConnectionOptions describe how to configure a bus.Connection
type DisconnectMessage ¶ added in v0.7.0
DisconnectMessage is sent when the connection is broken
type Event ¶ added in v0.7.0
type Event int
Event describes different events which can happen over the life of a connection. Currently only BusConnection is supported.
type EventHandler ¶ added in v0.7.0
type EventHandler func(conn Connection, event Event)
EventHandler is called when a bus event occurs.
type MQTTConnection ¶ added in v0.7.0
type MQTTConnection struct {
// contains filtered or unexported fields
}
MQTTConnection is a MQTT-specific implementation of bus.Connection
func (*MQTTConnection) Connect ¶ added in v0.7.0
func (mqc *MQTTConnection) Connect(options ConnectionOptions) error
Connect is required by the bus.Connection interface
func (*MQTTConnection) Disconnect ¶ added in v0.9.0
func (mqc *MQTTConnection) Disconnect() error
Disconnect is required by the bus.Connection interface
func (*MQTTConnection) Publish ¶ added in v0.7.0
func (mqc *MQTTConnection) Publish(topic string, payload []byte) error
Publish is required by the bus.Connection interface
func (*MQTTConnection) Subscribe ¶ added in v0.7.0
func (mqc *MQTTConnection) Subscribe(topic string, handler SubscriptionHandler) error
Subscribe is required by the bus.Connection interface
type MessagePublisher ¶ added in v0.7.0
MessagePublisher sends messages on the message bus
type SubscriptionHandler ¶ added in v0.7.0
type SubscriptionHandler func(conn Connection, topic string, message []byte)
SubscriptionHandler is called when a message is received on its corresponding topic subscription