Skip to content

Commit c024c2f

Browse files
committed
Merge branch 'no-emit-no-clients'
2 parents c782522 + 92a8e17 commit c024c2f

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

lib/framework/AnalyticsService.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class AnalyticsService
3636

3737
void loop()
3838
{
39+
if (!_socket->getConnectedClients()) return;
40+
3941
if (millis() - lastMillis > ANALYTICS_INTERVAL)
4042
{
4143
lastMillis = millis();

lib/framework/BatteryService.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ void BatteryService::begin()
4646

4747
void BatteryService::batteryEvent()
4848
{
49+
if (!_socket->getConnectedClients()) return;
50+
4951
JsonDocument doc;
5052
doc["soc"] = _lastSOC;
5153
doc["charging"] = _isCharging;

lib/framework/EventEndpoint.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ class EventEndpoint
6060

6161
void syncState(const String &originId, bool sync = false)
6262
{
63+
if (!_socket->getConnectedClients()) return;
64+
6365
JsonDocument jsonDocument;
6466
JsonObject root = jsonDocument.to<JsonObject>();
6567
_statefulService->read(root, _stateReader);

lib/framework/NotificationService.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ void NotificationService::begin()
1414

1515
void NotificationService::pushNotification(String message, pushType event)
1616
{
17+
if (!_eventSocket->getConnectedClients()) return;
18+
1719
JsonDocument doc;
1820
doc["type"] = pushTypeStrings[event];
1921
doc["message"] = message;

lib/framework/WiFiSettingsService.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ void WiFiSettingsService::configureNetwork(wifi_settings_t &network)
240240

241241
void WiFiSettingsService::updateRSSI()
242242
{
243+
if (!_socket->getConnectedClients()) return;
244+
243245
JsonDocument doc;
244246
doc["rssi"] = WiFi.RSSI();
245247
doc["ssid"] = WiFi.isConnected() ? WiFi.SSID() : "disconnected";

0 commit comments

Comments
 (0)