Documentation ¶
Overview ¶
Package catbus is a convenience wrapper around MQTT for use with Catbus.
Index ¶
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { Connect() error Subscribe(topic string, f MessageHandler) error Publish(topic string, retention Retention, payload string) error }
func NewClient ¶
func NewClient(brokerURI string, options ClientOptions) Client
type ClientOptions ¶
type ClientOptions struct { DisconnectHandler func(Client, error) ConnectHandler func(Client) // SubscribeEveryMessage determines if the Subscribe callback will be called for all incoming messages. // When SubscribeEveryMessage is false, the Subscribe callback will only trigger when the value changes. SubscribeEveryMessage bool // Publish previously seen or default values on connecting after OnconnectDelay ± [0,OnconnectJitter). OnconnectDelay time.Duration OnconnectJitter time.Duration // DefaultPayloadByTopic are optional values to publish on connect if no prior values are seen. // E.g. unless we've been told otherwise, assume a device is off. DefaultPayloadByTopic map[string]string }
Click to show internal directories.
Click to hide internal directories.