I\'m trying to send JSON data to the browser with SSE but I can\'t seem to get it right and I don\'t know why.
Server side looks like this:
var expre
Try sending proper JSON (testdata isn't quoted in your output):
testdata
res.write('data: {"msg": "'+ testdata +'"}\n\n');
But preferably:
res.write('data: ' + JSON.stringify({ msg : testdata }) + '\n\n');