#include <mqtt_publisher.h>
A thin wrapper over mqtt::async_client that only publishes to one topic. Unlike MqttSubscriber it does not subscribe, so it does not receive its own messages back
◆ MqttPublisher()
| bitsim::network::MqttPublisher::MqttPublisher |
( |
const std::string & | server, |
|
|
const std::string & | topic ) |
◆ ~MqttPublisher()
| bitsim::network::MqttPublisher::~MqttPublisher |
( |
| ) |
|
◆ connect()
| void bitsim::network::MqttPublisher::connect |
( |
| ) |
|
◆ is_connected()
| bool bitsim::network::MqttPublisher::is_connected |
( |
| ) |
const |
|
inlinenoexcept |
◆ publish() [1/2]
| void bitsim::network::MqttPublisher::publish |
( |
const nlohmann::json & | payload, |
|
|
int_t | qos = 0, |
|
|
bool | retained = false ) |
Publish the JSON payload
- Parameters
-
◆ publish() [2/2]
| void bitsim::network::MqttPublisher::publish |
( |
const std::string & | payload, |
|
|
int_t | qos = 0, |
|
|
bool | retained = false ) |
Publish the payload to the topic
- Parameters
-
◆ topic()
| std::string bitsim::network::MqttPublisher::topic |
( |
| ) |
const |
|
inlinenoexcept |
The documentation for this class was generated from the following files: