import "gobot.io/x/gobot/platforms/mqtt"
Package mqtt provides Gobot adaptor for the mqtt message service.
Installing:
go get gobot.io/x/gobot/platforms/mqtt
For further information refer to mqtt README: https://github.com/hybridgroup/gobot/blob/master/platforms/mqtt/README.md
doc.go mqtt_adaptor.go mqtt_driver.go
const ( // Data event when data is available for Driver Data = "data" // Error event when error occurs in Driver Error = "error" )
var ( // ErrNilClient is returned when a client action can't be taken because the struct has no client ErrNilClient = errors.New("no MQTT client available") )
Adaptor is the Gobot Adaptor for MQTT
NewAdaptor creates a new mqtt adaptor with specified host and client id
NewAdaptorWithAuth creates a new mqtt adaptor with specified host, client id, username, and password.
AutoReconnect returns the MQTT AutoReconnect setting
CleanSession returns the MQTT CleanSession setting
ClientCert returns the MQTT client SSL cert file
ClientKey returns the MQTT client SSL key file
Connect returns true if connection to mqtt is established
Disconnect returns true if connection to mqtt is closed
Finalize returns true if connection to mqtt is finalized successfully
Name returns the MQTT Adaptor's name
On subscribes to a topic, and then calls the message handler function when data is received
OnWithQOS allows per-subscribe QOS values to be set and returns a paho.Token
Port returns the Host name
Publish a message under a specific topic
PublishAndRetain publishes a message under a specific topic with retain flag
PublishWithQOS allows per-publish QOS values to be set and returns a paho.Token
ServerCert returns the MQTT server SSL cert file
SetAutoReconnect sets the MQTT AutoReconnect setting
SetCleanSession sets the MQTT CleanSession setting. Should be false if reconnect is enabled. Otherwise all subscriptions will be lost
SetClientCert sets the MQTT client SSL cert file
SetClientKey sets the MQTT client SSL key file
SetName sets the MQTT Adaptor's name
SetQoS sets the QoS value passed into the MTT client on Publish/Subscribe events
SetServerCert sets the MQTT server SSL cert file
SetUseSSL sets the MQTT server SSL preference
UseSSL returns the MQTT server SSL preference
Driver for mqtt
NewDriver returns a new Gobot MQTT Driver
func (m *Driver) Connection() gobot.Connection
Connection returns Connections used by the Driver
Halt halts the Driver
Name returns name for the Driver
On subscribes to data updates for the current device topic, and then calls the message handler function when data is received
Publish a message to the current device topic
Name sets name for the Driver
SetTopic sets the current topic for the Driver
Start starts the Driver
Topic returns the current topic for the Driver
Message is a message received from the broker.
Package mqtt imports 7 packages (graph) and is imported by 7 packages. Updated 2020-12-02. Refresh now. Tools for package owners.