Sha256: e6f71a366e3d983fa3ec7d5bb38ad266af1bc91277dc238e607c06fc8dbc4ffb
Contents?: true
Size: 614 Bytes
Versions: 4
Compression:
Stored size: 614 Bytes
Contents
module Dashing class EventsController < ApplicationController include ActionController::Live 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
4 entries across 4 versions & 1 rubygems