Class: EventsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- EventsController
- Includes:
- ActionController::Live
- Defined in:
- app/controllers/events_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#index ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/events_controller.rb', line 6 def index redis = Redis.new redis.psubscribe("build.*") do |on| on. do |pattern, event, data| response.stream.write("event: #{event}\n") response.stream.write("data: #{data}\n\n") end end rescue IOError rescue Redis::CannotConnectError head 503 ensure redis.quit rescue nil response.stream.close end |