I am trying to implement Server Sent Events using the HTTP connector in Mule 4.4.0. I have a flow with an HTTP Listener that is accepting SSE client connections and responding to the SSE heartbeat:
<flow name="SSE_Subscribe_Flow">
<http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/events/subscribe" allowedMethods="GET" responseStreamingMode="ALWAYS">
<http:response statusCode="200" >
<http:headers><![CDATA[#[output application/java
---
{
"Content-Type" : "text/event-stream",
"Cache-Control" : "no-cache",
"Connection" : "keep-alive"
}]]]>
</http:headers>
</http:response>
</http:listener>
<logger level="INFO" message="#[message]"/>
</flow>
Is it possible to push messages to the open connection from other flows?
Mule currently doesn't support Server-Sent Events. As an alternative, if you can use Websockets instead note that Mule 4 has a Websockets connector.