1

I wanted to test the new streaming feature. The code below works fine in Chrome, its streaming as it should. However in Firefox 23 I get the dialog window "You have chosen to open" -> "Open with" / "Save file" with that request.

def show
  response.headers[ "Content-Type" ] = "text/event-stream"
  3.times { 
    response.stream.write "Hello, browser!\n" 
    sleep 1 }
  response.stream.close
end

curl response headers contain:

Content-Type: text/event-stream

4

1 回答 1

0

我不确定 Firefox 23,但在某些浏览器中不支持服务器发送事件。如果是 Firefox 23 的情况,请尝试使用与旧浏览器兼容的EventSource Polyfill 。

有关 SSE 的更多信息,请查看此演示文稿

于 2013-09-24T13:16:25.620 回答