// SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include "ArduinoJson.h" #include #include class WebApiWsLiveClass { public: WebApiWsLiveClass(); void init(AsyncWebServer* server); void loop(); private: void addField(JsonDocument& root, uint8_t idx, std::shared_ptr inv, uint8_t channel, uint8_t fieldId, String topic = ""); void onWebsocketEvent(AsyncWebSocket* server, AsyncWebSocketClient* client, AwsEventType type, void* arg, uint8_t* data, size_t len); AsyncWebServer* _server; AsyncWebSocket _ws; uint32_t _lastWsPublish = 0; uint32_t _lastInvUpdateCheck = 0; unsigned long _lastWsCleanup = 0; uint32_t _newestInverterTimestamp = 0; };