When message payload contains \r, \n or \r\n then by SSE spec they are canonicalized to \n.
message
event
data: 1\n
data: 2\n
data: 3\n
data: 4\n
\n
Therefore, we must inject \ndata: to replace \r, \n or \r\n in the message payload, and the event still starts with data: and ends with \n\n as usual.