Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

SSE over https not working

$
0
0

I am having an issue with SSE over https, let me make it clear, I have an Nginx server that listen to https, and a Rails Puma in the back, So I have this in the js( coffescript ):

initStream = () ->   rechargePayment.source = new     EventSource('/proggress/stream')

and in the rails controller I have:

  def stream    response.headers['Content-Type'] = 'text/event-stream'    redis = Redis.new    redis.psubscribe(['proggress.refresh', 'heartbeat']) do |on|      on.pmessage do |_pattern, event, data|        response.stream.write("event: #{event}\n")        response.stream.write("data: #{data}\n\n")      end    end  rescue IOError    logger.info 'Stream stoped'  ensure    logger.info 'Stopping Stream Thread'    redis.quit    response.stream.close  end

When I try this over https, it does nothing, in the logs I only see the error: "Stream closed", but if I try it over http it works perfectly.

EDIT: I saw this:"The EventSource interface is used to receive server-sent events. It connects to a server over HTTP and receives events in text/event-stream format without closing the connection."

source: https://developer.mozilla.org/en-US/docs/Web/API/EventSource

So, does this mean that it works only in http?


Viewing all articles
Browse latest Browse all 873

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>