Documentation ¶
Index ¶
- type Mqtt
- type MqttClient
- func (mqttClient *MqttClient) CallWebService(msg mqtt.Message, topic string, handler string)
- func (mqttClient *MqttClient) Connect() error
- func (mqttClient *MqttClient) Initialize_mqttClient()
- func (mqttClient *MqttClient) MonitorAndReconnect()
- func (mqttClient *MqttClient) Publish(topic string, payload string)
- func (mqttClient *MqttClient) SubscribeTopics()
- type MqttConfig
- type MqttTopic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mqtt ¶
type Mqtt struct { Type string `json:"type"` // tcp, ws, wss Broker string `json:"broker"` Port string `json:"port"` CertFile string `json:"certFile"` KeyFile string `json:"keyFile"` CaCertFile string `json:"caFile"` Username string `json:"username"` Password string `json:"password"` Topics []MqttTopic `json:"topics"` AutoReconnect bool `json:"reconnect"` }
type MqttClient ¶
type MqttClient struct { Config Mqtt Client mqtt.Client Queue *queue.MessageQueue DocDBconn *documents.DocDB DB *sql.DB SignalRClient signalr.Client AppServer string ApiKey string // contains filtered or unexported fields }
func NewMqttClient ¶
func NewMqttClient(configurations Mqtt) *MqttClient
NewMqttClient creates a new instance of MqttClient with the given configurations. It initializes the MqttClient with the provided configurations and returns a pointer to the created MqttClient. The MqttClient is initialized with the following parameters: - mqttBrokertype: a string representing the type of the MQTT broker (tcp, ws, wss). - mqttBroker: a string representing the MQTT broker address. - mqttPort: a string representing the MQTT broker port. - certFile: a string representing the certificate file path. - keyFile: a string representing the key file path. - caCertFile: a string representing the CA certificate file path. - mqttClientID: a string representing the MQTT client ID. - mqttTopics: a slice of MqttTopic structs representing the MQTT topics to subscribe to. - iLog: a logger.Log struct representing the logger. - Client: a mqtt.Client struct representing the MQTT client.
func NewMqttClientbyExternal ¶
func NewMqttClientbyExternal(configurations Mqtt, DB *sql.DB, DocDBconn *documents.DocDB, SignalRClient signalr.Client) *MqttClient
NewMqttClientbyExternal creates a new instance of MqttClient with the provided configurations, database connection, document database connection, and SignalR client. It initializes the MqttClient with the given configurations and returns the created MqttClient instance. The MqttClient is initialized with the following parameters: - mqttBrokertype: a string representing the type of the MQTT broker (tcp, ws, wss). - mqttBroker: a string representing the MQTT broker address. - mqttPort: a string representing the MQTT broker port. - certFile: a string representing the certificate file path. - keyFile: a string representing the key file path. - caCertFile: a string representing the CA certificate file path. - mqttClientID: a string representing the MQTT client ID. - mqttTopics: a slice of MqttTopic structs representing the MQTT topics to subscribe to. - iLog: a logger.Log struct representing the logger.
func (*MqttClient) CallWebService ¶
func (mqttClient *MqttClient) CallWebService(msg mqtt.Message, topic string, handler string)
func (*MqttClient) Connect ¶
func (mqttClient *MqttClient) Connect() error
func (*MqttClient) Initialize_mqttClient ¶
func (mqttClient *MqttClient) Initialize_mqttClient()
func (*MqttClient) MonitorAndReconnect ¶
func (mqttClient *MqttClient) MonitorAndReconnect()
func (*MqttClient) Publish ¶
func (mqttClient *MqttClient) Publish(topic string, payload string)
func (*MqttClient) SubscribeTopics ¶
func (mqttClient *MqttClient) SubscribeTopics()