Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 082cbec539
Fetching contributors…

Cannot retrieve contributors at this time

24 lines (19 sloc) 0.501 kB
require 'reloader/sse'
class BrowserController < ApplicationController
include ActionController::Live
def index
# SSE expects the `text/event-stream` content type
response.headers['Content-Type'] = 'text/event-stream'
sse = Reloader::SSE.new(response.stream)
begin
loop do
sse.write({ :time => Time.now })
sleep 1
end
rescue IOError
# When the client disconnects, we'll get an IOError on write
ensure
sse.close
end
end
end
Jump to Line
Something went wrong with that request. Please try again.