From 7a84f0b33d6827195dd6134a12007992f7795905 Mon Sep 17 00:00:00 2001 From: ayaya Date: Mon, 12 May 2014 23:44:26 +0800 Subject: Add multiple lines message support for SSE module --- actionpack/lib/action_controller/metal/live.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/metal/live.rb b/actionpack/lib/action_controller/metal/live.rb index acf40b2e16..4c0554d27b 100644 --- a/actionpack/lib/action_controller/metal/live.rb +++ b/actionpack/lib/action_controller/metal/live.rb @@ -102,7 +102,8 @@ module ActionController end end - @stream.write "data: #{json}\n\n" + message = json.gsub("\n", "\ndata: ") + @stream.write "data: #{message}\n\n" end end -- cgit v1.2.3