Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MqttClient ¶
type MqttClient interface { Start() Stop() // contains filtered or unexported methods }
MqttClient defines the needed methods to control our MQTT client
type MqttClientBase ¶
type MqttClientBase struct { Qos byte Client paho.Client Host string Username string Password string KeepAlive time.Duration PingTimeout time.Duration Connecting bool PublishChannel chan *models.PublishMessage }
MqttClientBase holds information on our client needed for a Publish and Subscription client
func (*MqttClientBase) SetClientBase ¶
func (m *MqttClientBase) SetClientBase(host string, qos byte, clientID string, channel chan *models.PublishMessage, username string, password string, keepAlive time.Duration, pingTimeout time.Duration)
SetClientBase sets the base parameters needed for our MQTT client and creates the MQTT client
type MqttPubClient ¶
type MqttPubClient struct {
MqttClientBase
}
MqttPubClient is the implementation of the publish client, the publish client will connect to the broker where all the incoming messages needs to be send to
func CreatePubClient ¶
func CreatePubClient(host string, qos byte, clientID string, channel chan *models.PublishMessage, username string, password string, keepAlive time.Duration, pingTimeout time.Duration) MqttPubClient
CreatePubClient instantiates a MqttPubClient
func (*MqttPubClient) Start ¶
func (m *MqttPubClient) Start()
Start will start the publish client by connecting and start listening on the PublishChannel
type MqttSubClient ¶
type MqttSubClient struct { MqttClientBase Streams []models.Stream }
MqttSubClient is the implementation of the subscription client, the subscription client will connect to a broker where messages can be received
func CreateSubClient ¶
func CreateSubClient(host string, qos byte, streams []models.Stream, clientID string, channel chan *models.PublishMessage, username string, password string, keepAlive time.Duration, pingTimeout time.Duration) MqttSubClient
CreateSubClient instantiates a MqttSubClient
func (*MqttSubClient) Start ¶
func (m *MqttSubClient) Start()
Start will start the subscription client by connecting and subscribing on topics