Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4689,7 +4689,7 @@ int main(int argc, char ** argv) {
return server_sent_event(sink, "data", res_json);
}
}, [&](const json & error_data) {
server_sent_event(sink, "error", error_data);
server_sent_event(sink, "data", json{{"error", error_data}});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we no longer need the second argument of server_sent_event, as it will always be "data"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that makes sense.
Should this be kept in a way to make it compatible with the actual event field of the SSE spec (in a line above the data - if specified) or should that parameter be completely removed and simply always only use the data line?
e.g.

event: error
data: {error: {....}}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most parsers will accept format data: {error: {....}}, anything outside of that always caused problems for downstream in the past, like the data: [DONE] for example.

}, [&sink]() {
// note: do not use req.is_connection_closed here because req is already destroyed
return !sink.is_writable();
Expand Down
Loading