Faye server is not launching or starting
-
15-03-2021 - |
Question
I'm following railscast and have followed the instructions exactly. I've even used net.tutsplus's faye.ru code to set up the faye.ru file in the root directory.
Here's the faye.ru file:
require 'faye'
faye_server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 45)
run faye_server
When I try to launch the server with rackup faye.ru -s thin -E production
,
I get the following error:
/Users/TonyNg/faye-tutorial/faye.ru:3:in `block in <main>': undefined local variable or method ` ' for #<Rack::Builder:0x00000100918420 @ins=[]> (NameError)
from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/builder.rb:51:in `instance_eval'
from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/builder.rb:51:in `initialize'
from /Users/TonyNg/faye-tutorial/faye.ru:1:in `new'
from /Users/TonyNg/faye-tutorial/faye.ru:1:in `<main>'
from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/builder.rb:40:in `eval'
from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/builder.rb:40:in `parse_file'
from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/server.rb:200:in `app'
from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/server.rb:301:in `wrapped_app'
from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/server.rb:252:in `start'
from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/server.rb:137:in `start'
from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/bin/rackup:4:in `<top (required)>'
from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/bin/rackup:19:in `load'
from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/bin/rackup:19:in `<main>'
It seems to just work for Ryan, but I'm out of luck.
Solution
I found a solution. I instead ran rackup -s thin -E production config.ru
(config.ru instead of faye.ru) and got a working server consisting of:
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:9292, CTRL+C to stop
Apparently, Rack's development middleware doesn't work with Thin async responses as I am using Thin in this app.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow