Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
xyzroe committed May 27, 2024
1 parent 2499e1b commit b980a62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// AUTO GENERATED FILE
#ifndef VERSION
#define VERSION "20240526"
#define VERSION "20240528"
#endif
21 changes: 9 additions & 12 deletions src/web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,13 @@ void handleEspUpdateUpload()
}
}

void handleEvents()
{
if (is_authenticated())
{
void handleEvents() {
if (is_authenticated()) {
if (eventsClient) {
eventsClient.stop();
}
eventsClient = serverWeb.client();
if (eventsClient)
{ // send events header
if (eventsClient) {
eventsClient.println("HTTP/1.1 200 OK");
eventsClient.println("Content-Type: text/event-stream;");
eventsClient.println("Connection: close");
Expand All @@ -369,15 +369,12 @@ void handleEvents()
}
}

void sendEvent(const char *event, const uint8_t evsz, const String data)
{
if (eventsClient)
{
void sendEvent(const char *event, const uint8_t evsz, const String data) {
if (eventsClient) {
char evnmArr[10 + evsz];
sprintf(evnmArr, "event: %s\n", event);
snprintf(evnmArr, sizeof(evnmArr), "event: %s\n", event);
eventsClient.print(evnmArr);
eventsClient.print(String("data: ") + data + "\n\n");
// eventsClient.println();
eventsClient.flush();
}
}
Expand Down

0 comments on commit b980a62

Please sign in to comment.