no need to send mqtt message on ws call ~

This commit is contained in:
debsahu 2018-04-29 01:53:37 -04:00
parent 25deb214a2
commit 7b49df36a7

View file

@ -569,12 +569,6 @@ void checkpayload(uint8_t * payload, bool mqtt = false, uint8_t num = 0) {
String json = listStatusJSON();
if (mqtt == true) {
DBG_OUTPUT_PORT.print("MQTT: ");
} else {
DBG_OUTPUT_PORT.print("WS: ");
webSocket.sendTXT(num, "OK");
}
DBG_OUTPUT_PORT.println("Get status info: " + json);
webSocket.sendTXT(num, json);
#ifdef ENABLE_MQTT
mqtt_client.publish(mqtt_outtopic, listStatusJSON());
#endif
@ -582,6 +576,12 @@ void checkpayload(uint8_t * payload, bool mqtt = false, uint8_t num = 0) {
String liststat = (String) listStatusJSON();
amqttClient.publish(mqtt_outtopic.c_str(), qospub, false, liststat.c_str());
#endif
} else {
DBG_OUTPUT_PORT.print("WS: ");
webSocket.sendTXT(num, "OK");
webSocket.sendTXT(num, json);
}
DBG_OUTPUT_PORT.println("Get status info: " + json);
}
// ~ ==> Get WS2812 modes.
@ -589,14 +589,9 @@ void checkpayload(uint8_t * payload, bool mqtt = false, uint8_t num = 0) {
String json = listModesJSON();
if (mqtt == true) {
DBG_OUTPUT_PORT.print("MQTT: ");
} else {
DBG_OUTPUT_PORT.print("WS: ");
webSocket.sendTXT(num, "OK");
}
DBG_OUTPUT_PORT.println("Get WS2812 modes.");
DBG_OUTPUT_PORT.println(json);
webSocket.sendTXT(num, json);
#ifdef ENABLE_MQTT
// TODO: Fix this, doesn't return anything. Too long?
// Hint: https://github.com/knolleary/pubsubclient/issues/110
DBG_OUTPUT_PORT.printf("Error: Not implemented. Message too large for pubsubclient.");
mqtt_client.publish(mqtt_outtopic, "ERROR: Not implemented. Message too large for pubsubclient.");
//String json_modes = listModesJSON();
@ -608,11 +603,16 @@ void checkpayload(uint8_t * payload, bool mqtt = false, uint8_t num = 0) {
#ifdef ENABLE_AMQTT
amqttClient.publish(mqtt_outtopic.c_str(), qospub, false, json.c_str());
#endif
} else {
DBG_OUTPUT_PORT.print("WS: ");
webSocket.sendTXT(num, "OK");
webSocket.sendTXT(num, json);
}
DBG_OUTPUT_PORT.println("Get WS2812 modes.");
DBG_OUTPUT_PORT.println(json);
}
// / ==> Set WS2812 mode.
// TODO: Fix this, doesn't return anything. Too long?
// Hint: https://github.com/knolleary/pubsubclient/issues/110
if (payload[0] == '/') {
handleSetWS2812FXMode(payload);
if (mqtt == true) {