Skip to content

Commit d2c0111

Browse files
authored
docs: add server utils.hpp comment
Add a comment mentioning the requirement for server-sent events to end with 2 newlines.
1 parent c23bfc5 commit d2c0111

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/server/utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ static bool server_sent_event(httplib::DataSink & sink, const char * event, cons
296296
const std::string str =
297297
std::string(event) + ": " +
298298
data.dump(-1, ' ', false, json::error_handler_t::replace) +
299-
"\n\n"; // note: these newlines are important (not sure why though, if you know, add a comment to explain)
299+
"\n\n"; // The server-sent events standard requires each event to end with 2 newlines.
300300

301301
LOG_DBG("data stream, to_send: %s", str.c_str());
302302

0 commit comments

Comments
 (0)