lib/rasti/web/broadcaster.rb in rasti-web-broadcaster-1.0.0 vs lib/rasti/web/broadcaster.rb in rasti-web-broadcaster-1.1.0
- old
+ new
@@ -34,16 +34,17 @@
end
end
end
- def initialize(app)
+ def initialize(app, headers={})
@app = app
+ @headers = headers
end
def call(env)
if Faye::EventSource.eventsource? env
- event_source = Faye::EventSource.new env
+ event_source = Faye::EventSource.new env, headers: @headers
channel = env['PATH_INFO'][1..-1]
subscription_id = self.class.subscribe channel do |message|
event_source.send message[:data], event: message[:event],
id: message[:id]