acdesouza/rails-and-server-sent-events — pull request #2 by fabiolnm (2014-11-02 23:05:43+00:00)
Title: Fix project to really make use of Rails SSE

UsersController#index_stream was actually returning, and connection was closing.

This makes EventSource poll a new request - by default after 3 seconds.

The fix consisted in keeping action alive using a infinite loop:

loop { sleep 1 }

And user updates to use an ActiveSupport pub/sub mechanism. Sadly this design doesn't work on heroku, due to 30s timeout.

In fact, tenderlove had trouble like this: http://tenderlovemaking.com/2012/07/30/is-it-live.html:

Heroku will cut off your connections after 30 seconds.
I had trouble getting the SSE to reconnect to a Heroku server,
but I haven’t had time to investigate the issue.

At this point, SSE and Heroku is just a complex way to implement 3s request polling.