MCPcopy Create free account
hub / github.com/SmingHub/Sming / publishMessage

Function publishMessage

samples/MqttClient_Hello/app/application.cpp:48–59  ·  view source on GitHub ↗

Publish our message

Source from the content-addressed store, hash-verified

46
47// Publish our message
48void publishMessage()
49{
50 if(mqtt.getConnectionState() != eTCS_Connected) {
51 startMqttClient(); // Auto reconnect
52 }
53
54 Serial << _F("Let's publish message now. Memory free=") << system_get_free_heap_size() << endl;
55 mqtt.publish(F("main/frameworks/sming"), F("Hello friends, from Internet of things :)"));
56
57 mqtt.publish(F("important/frameworks/sming"), F("Request Return Delivery"),
58 MqttClient::getFlags(MQTT_QOS_AT_LEAST_ONCE));
59}
60
61// Callback for messages, arrived from MQTT server
62int onMessageReceived(MqttClient& client, mqtt_message_t* message)

Callers 1

startMqttClientFunction · 0.70

Calls 5

getConnectionStateMethod · 0.80
publishMethod · 0.80
startMqttClientFunction · 0.70
FFunction · 0.50

Tested by

no test coverage detected