Looks like the problem is that the TestServer has to be in quotes for config.middleware.use
call.
The answer here helped: https://stackoverflow.com/a/16206347/3467
The Heroku howto is incorrect, sent them an comment to fix it.
Frage
Trying to get Heroku's WebSocket tutorial working with a Rails app but the middleware is not loading.
Steps to reproduce:
faye-websocket
gem and run bundle install
app/middleware
directory in the applicationapp/middleware/test_server.rb
require 'faye/websocket' class TestServer KEEPALIVE_TIME = 15 # in seconds def initialize(app) @app = app @clients = [] end def call(env) end end
config/application.rb
config.middleware.use TestServer
rails console
I see the following error:
config/application.rb:64:in `': uninitialized constant RackMiddleware::Application::TestServer (NameError)
If I add require 'test_server'
, I see the following error:
config/application.rb:5:in `require': cannot load such file -- test_server (LoadError)
I thought an directories in app/
were automatically added in Rails 3. What am I doing wrong?
Lösung
Looks like the problem is that the TestServer has to be in quotes for config.middleware.use
call.
The answer here helped: https://stackoverflow.com/a/16206347/3467
The Heroku howto is incorrect, sent them an comment to fix it.