Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP Streaming on Heroku with Rails 3.1 & Unicorn

Inspired by the RailsCast on HTTP Streaming, I've decided to turn it on on my server. However, the listen 3000 :tcp_nopush => false line that Ryan suggests adding to my unicorn.rb doesn't play well with Heroku (they don't let you specify a port). Is streaming supported on Heroku, and how do I turn it on?

like image 470
Sudhir Jonathan Avatar asked Jan 19 '23 21:01

Sudhir Jonathan


1 Answers

Heroku tells your application what port to listen on via the environment variable PORT. Check for this environment variable in your unicorn.rb.

port = ENV["PORT"].to_i
listen port, :tcp_nopush => false
like image 125
yfeldblum Avatar answered Jan 21 '23 10:01

yfeldblum