Browse Source

Do not broadcast messages via websocket if there is no client connected

fastled
Xose Pérez 7 years ago
parent
commit
ffd54f1abf
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      code/espurna/web.ino

+ 4
- 2
code/espurna/web.ino View File

@ -44,8 +44,10 @@ char _last_modified[50];
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool wsSend(const char * payload) { bool wsSend(const char * payload) {
DEBUG_MSG("[WEBSOCKET] Broadcasting '%s'\n", payload);
ws.textAll(payload);
if (ws.count() > 0) {
DEBUG_MSG("[WEBSOCKET] Broadcasting '%s'\n", payload);
ws.textAll(payload);
}
} }
bool wsSend(uint32_t client_id, const char * payload) { bool wsSend(uint32_t client_id, const char * payload) {


Loading…
Cancel
Save