For example, in Hotwire Turbo Streams (https://turbo.hotwired.dev/handbook/streams) HTML can be sent as an event and update a portion of a page. Currently sending a string of HTML with newlines will produce the following event.
event: message
data: <turbo-stream action='append' target='messages'>
<template>
<div id='message_2'>
The content of the message.
</div>
</template>
</turbo-stream>
However, the browser will only handle the first line of data because the subsequent lines do not have a leading "data:". This PR adds processing to break apart the payload to add "data:" to each line.
event: message
data: <turbo-stream action='append' target='messages'>
data: <template>
data: <div id='message_2'>
data: The content of the message.
data: </div>
data: </template>
data: </turbo-stream>
This adds support for multiline payloads.
For example, in Hotwire Turbo Streams (https://turbo.hotwired.dev/handbook/streams) HTML can be sent as an event and update a portion of a page. Currently sending a string of HTML with newlines will produce the following event.
However, the browser will only handle the first line of data because the subsequent lines do not have a leading "data:". This PR adds processing to break apart the payload to add "data:" to each line.