Documentation
¶
Index ¶
- Variables
- type MQTTBroker
- func (m *MQTTBroker) Connect() error
- func (m *MQTTBroker) ConnectAndSubscribe(subHandler broker.Handler, subTopics []string) error
- func (m *MQTTBroker) Disconnect() error
- func (m *MQTTBroker) Publish(topic string, payload interface{}) error
- func (m *MQTTBroker) String() string
- func (m *MQTTBroker) Subscribe(topics []string, h broker.Handler) error
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoConnection = errors.New("no connection to broker server")
Functions ¶
This section is empty.
Types ¶
type MQTTBroker ¶
type MQTTBroker struct {
// contains filtered or unexported fields
}
MQTTBroker implements broker.Broker interface.
func NewBroker ¶
func NewBroker(opts ...Option) (*MQTTBroker, error)
NewBroker creates new mqtt broker.
func (*MQTTBroker) Connect ¶
func (m *MQTTBroker) Connect() error
func (*MQTTBroker) ConnectAndSubscribe ¶ added in v1.0.16
func (m *MQTTBroker) ConnectAndSubscribe(subHandler broker.Handler, subTopics []string) error
connect and update option to auto resubscribe with option OnConnect
func (*MQTTBroker) Disconnect ¶
func (m *MQTTBroker) Disconnect() error
func (*MQTTBroker) Publish ¶
func (m *MQTTBroker) Publish(topic string, payload interface{}) error
func (*MQTTBroker) String ¶
func (m *MQTTBroker) String() string
type Option ¶
type Option func(m *MQTTBroker) error
func WithClientID ¶
WithClientID returns an Option which set the broker client id.
func WithLogger ¶ added in v1.0.16
WithLogger returns an Option which set the logger to use when connect to server.
func WithPassword ¶
WithPassword returns an Option which set the password use to connect to server.
func WithUsername ¶
WithUsername returns an Option which set the username use to connect to server.
Click to show internal directories.
Click to hide internal directories.