mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 22:52:19 +03:00
отправка конфига в сокеты
This commit is contained in:
18
src/WebSocket.cpp
Normal file
18
src/WebSocket.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "WebSocket.h"
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
void wsSendSetup() {
|
||||
File file = seekFile("/setup.json");
|
||||
DynamicJsonDocument doc(1024);
|
||||
file.find("[");
|
||||
do {
|
||||
deserializeJson(doc, file);
|
||||
wsPublishData(F("config"), doc.as<String>());
|
||||
} while (file.findUntil(",", "]"));
|
||||
}
|
||||
|
||||
void wsPublishData(String topic, String data) {
|
||||
data = "[" + topic + "]" + data;
|
||||
ws.textAll(data);
|
||||
}
|
||||
Reference in New Issue
Block a user