I'm trying to listen to SSE events from a controller action.
I am setting the headers in the controller action with:
Craft::$app->response->headers
->set('Content-Type: text/event-stream')
->set('Cache-Control: no-cache');
The EventSource listener always gives me:
EventSource's response has a MIME type ("text/html") that is not "text/event-stream". Aborting the connection.
Checking the URL (controller action URL) manually, you can see indeed that the headers are "text/html" and I cannot change them.
What is a good way to send SSE events from CraftCMS?