From d2c0111da1fb45a4c1dd498c5b11b8b6b7a9f95c Mon Sep 17 00:00:00 2001 From: CentricStorm Date: Tue, 17 Sep 2024 05:50:02 +0100 Subject: [PATCH] docs: add server utils.hpp comment Add a comment mentioning the requirement for server-sent events to end with 2 newlines. --- examples/server/utils.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/server/utils.hpp b/examples/server/utils.hpp index 537c8a223..0953d1813 100644 --- a/examples/server/utils.hpp +++ b/examples/server/utils.hpp @@ -296,7 +296,7 @@ static bool server_sent_event(httplib::DataSink & sink, const char * event, cons const std::string str = std::string(event) + ": " + data.dump(-1, ' ', false, json::error_handler_t::replace) + - "\n\n"; // note: these newlines are important (not sure why though, if you know, add a comment to explain) + "\n\n"; // The server-sent events standard requires each event to end with 2 newlines. LOG_DBG("data stream, to_send: %s", str.c_str());