🚇 Adds hasSubcribers to event socket for early return

This commit is contained in:
Rune Harlyk
2024-08-02 15:35:36 +02:00
committed by Rune Harlyk
parent d182e9e925
commit e7f78c52da
3 changed files with 5 additions and 0 deletions
@@ -125,6 +125,8 @@ esp_err_t EventSocket::onFrame(PsychicWebSocketRequest *request, httpd_ws_frame
return ESP_OK;
}
bool EventSocket::hasSubscribers(const char *event) { return !client_subscriptions[event].empty(); }
void EventSocket::emit(const char *event, const char *payload, const char *originId, bool onlyToSameOrigin) {
int originSubscriptionId = originId[0] ? atoi(originId) : -1;
xSemaphoreTake(clientSubscriptionsMutex, portMAX_DELAY);