docs: add server utils.hpp comment

Add a comment mentioning the requirement for server-sent events to end with 2 newlines.
This commit is contained in:
CentricStorm 2024-09-17 05:50:02 +01:00 committed by GitHub
parent c23bfc5000
commit d2c0111da1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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());