I’m trying to build event-stream responses in the context of sending push data to a web page.
The idea is to have a CRLF after each message, then a final CRLF to signal the end of the messages.
So my answer is this:
<cfoutput>
<cfset newline = chr(13)&chr(10)>
<cfheader name="Content-Type" value="text/event-stream">
<cfheader name="Cache-Control" value="no-cache">
<cfheader name="Connection" value="keep-alive">
data: The server time is: #now()##newline#
#newline#
</cfoutput>
But the web page that receives it doesn’t take this into account: there aren’t two CRLFs at the end.
How can I correct this?