This commit is contained in:
Dmitry Borisenko
2021-12-07 22:20:00 +01:00
parent 1af7687064
commit 2a79a5880f
4 changed files with 10 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -7,5 +7,6 @@ void SerialPrint(String errorLevel, String module, String msg) {
String tosend = prettyMillis(millis()) + " [" + errorLevel + "] [" + module + "] " + msg; String tosend = prettyMillis(millis()) + " [" + errorLevel + "] [" + module + "] " + msg;
Serial.println(tosend); Serial.println(tosend);
ws.textAll(tosend); // mqttRootDevice +
ws.textAll("/core/" + tosend);
} }

View File

@@ -122,10 +122,11 @@ void onWsEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventTyp
// choose_log_date_and_send(); // функцию выгрузки архива с графиком я не сделал. Забираю при выгрузке по MQTT // choose_log_date_and_send(); // функцию выгрузки архива с графиком я не сделал. Забираю при выгрузке по MQTT
} }
if (info->opcode == WS_TEXT) if (info->opcode == WS_TEXT) {
client->text("{}"); // client->text("{}");
else } else {
client->binary("{}"); // client->binary("{}");
}
} else { } else {
// message is comprised of multiple frames or the frame is split into multiple packets // message is comprised of multiple frames or the frame is split into multiple packets
if (info->index == 0) { if (info->index == 0) {
@@ -206,7 +207,7 @@ void initWS() {
ws.onEvent(onWsEvent); ws.onEvent(onWsEvent);
server.addHandler(&ws); server.addHandler(&ws);
events.onConnect([](AsyncEventSourceClient *client) { events.onConnect([](AsyncEventSourceClient *client) {
client->send("", NULL, millis(), 1000); // client->send("", NULL, millis(), 1000);
}); });
server.addHandler(&events); server.addHandler(&events);
#endif #endif