Search code examples
ruby-on-railscometfaye

undefined method `close_connection_after_writing'


I have project on rails 3 with multiplayer using Faye. The error

block in close': undefined methodclose_connection_after_writing' for nil:NilClass (NoMethodError)

from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@chats/gems/faye-websocket-0.4.5/lib/faye/websocket/api.rb:89:in `call'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@chats/gems/faye-websocket-0.4.5/lib/faye/websocket/api.rb:89:in `close'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@chats/gems/faye-websocket-0.4.5/lib/faye/websocket.rb:198:in `fail'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@global/gems/thin-1.3.1/lib/thin/connection.rb:155:in `unbind'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@global/gems/eventmachine-0.12.10/lib/eventmachine.rb:1417:in `event_callback'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@global/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@global/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@global/gems/thin-1.3.1/lib/thin/backends/base.rb:61:in `start'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@global/gems/thin-1.3.1/lib/thin/server.rb:159:in `start'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@global/gems/rack-1.4.1/lib/rack/handler/thin.rb:13:in `run'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@global/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@global/gems/rack-1.4.1/lib/rack/server.rb:137:in `start'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@global/gems/rack-1.4.1/bin/rackup:4:in `<top (required)>'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@chats/bin/rackup:19:in `load'
    from /Users/ostap/.rvm/gems/ruby-1.9.3-p125@chats/bin/rackup:19:in `<main>'

after my faye server startup with command

rackup faye.ru -s thin -E production

What can I do with such error?? What couses it? How can I handle it?


Solution

  • i found on this page (it's in russian) http://habrahabr.ru/sandbox/45416/

    add this to your faye.ru file

    Faye::WebSocket.load_adapter('thin')

    this made my solution

    i hope it helps an thanks for the advice