lib/sse-channel.js
function parseTextData(text) {
    var data = String(text).replace(/(\r\n|\r|\n)/g, '\n');
    var lines = data.split(/\n/), line;

    var output = '';
    for (var i = 0, l = lines.length; i < l; ++i) {
        line = lines[i];

        output += 'data: ' + line;
        output += (i + 1) === l ? '\n\n' : '\n';
    }

    return output;
}
function parseTextData(text) {
    var data = String(text).replace(/(\r\n|\r|\n)/g, '\n');
    var lines = data.split(/\n/), line;

    var output = '';
    for (var i = 0, l = lines.length; i < l; ++i) {
        line = lines[i];

        output += 'data: ' + line;
        output += (i + 1) === l ? '\n\n' : '\n';
    }

    return output;
}
function parseTextData ( text ) { var data = String ( text ) . replace ( / (\r\n|\r|\n) / g , '\n' ) ; var lines = data . split ( / \n / ) , line ; var output = '' ; for ( var i = 0 , l = lines . length ; i < l ; ++ i ) { line = lines [ i ] ; output += 'data: ' + line ; output += ( i + 1 ) === l ? '\n\n' : '\n' ; } return output ; }
Parse text data, ensuring it doesn't break the SSE-protocol

@param  {String} text
@return {String}
Parse text data ensuring it doesn t break the SSE - protocol