Sha256: 58651cc2deff6bd02102712417857f430dbecc3f1bda97758200eb09dae99632
Contents?: true
Size: 636 Bytes
Versions: 13
Compression:
Stored size: 636 Bytes
Contents
module Dashing class EventsController < ApplicationController include ActionController::Live respond_to :html def index response.headers['Content-Type'] = 'text/event-stream' response.headers['X-Accel-Buffering'] = 'no' @redis = Dashing.redis @redis.psubscribe("#{Dashing.config.redis_namespace}.*") do |on| on.pmessage do |pattern, event, data| response.stream.write("data: #{data}\n\n") end end rescue IOError logger.info "[Dashing][#{Time.now.utc.to_s}] Stream closed" ensure @redis.quit response.stream.close end end end
Version data entries
13 entries across 13 versions & 1 rubygems