jcoglan/faye-websocket-ruby — Issue #2: NoMethodError when running faye-websocket
Author: botanicus
Created: 2011-12-12 10:35:54+00:00
State: open

Hi, I'm working on [Ruby client for SockJS](https://github.com/sockjs/sockjs-ruby) and I decided to use faye-websocket for handling websocket connections. Unfortunately when I run [examples/config.rb](https://github.com/sockjs/sockjs-ruby/blob/master/examples/app/config.rb), I'm getting:

/Users/botanicus/Dropbox/Projects/sockjs/ruby/vendor/faye-websocket/lib/faye/websocket/api.rb:35:in `block in close': undefined method `close_connection_after_writing' for nil:NilClass (NoMethodError)
from /Users/botanicus/Dropbox/Projects/sockjs/ruby/vendor/faye-websocket/lib/faye/websocket/api.rb:49:in `call'
from /Users/botanicus/Dropbox/Projects/sockjs/ruby/vendor/faye-websocket/lib/faye/websocket/api.rb:49:in `close'
from /Users/botanicus/Dropbox/Projects/sockjs/ruby/vendor/faye-websocket/lib/faye/websocket.rb:119:in `fail'
from /Users/botanicus/.rvm/gems/ruby-1.9.2-head@ruby-amqp/gems/thin-1.3.1/lib/thin/connection.rb:155:in `unbind'
from /Users/botanicus/.rvm/gems/ruby-1.9.2-head@ruby-amqp/gems/eventmachine-0.12.10/lib/eventmachine.rb:1417:in `event_callback'
from /Users/botanicus/.rvm/gems/ruby-1.9.2-head@ruby-amqp/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
from /Users/botanicus/.rvm/gems/ruby-1.9.2-head@ruby-amqp/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
from ./config.rb:88:in `

'

Apparently the problem is that in some cases `@stream` is `nil`.