ngauthier/tubesock — pull request #3 by korny (2013-06-02 23:48:12+00:00)
Title: Fix for Firefox

Not sure if this is a WebSocket problem or a tubesock one. The example app crashes for me on Firefox when I close a tab or reload with an open websocket connection:

```Exiting
/Users/murphy/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/json/common.rb:155:in `parse': 795: unexpected token at '?' (JSON::ParserError)
from /Users/murphy/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/json/common.rb:155:in `parse'
from /Users/murphy/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/json/common.rb:334:in `load'
from /Users/murphy/sofatutor/src/tubesock/lib/tubesock.rb:64:in `block (3 levels) in listen'
from /Users/murphy/sofatutor/src/tubesock/lib/tubesock.rb:64:in `each'
from /Users/murphy/sofatutor/src/tubesock/lib/tubesock.rb:64:in `block (2 levels) in listen'
from /Users/murphy/sofatutor/src/tubesock/lib/tubesock.rb:79:in `each_frame'
from /Users/murphy/sofatutor/src/tubesock/lib/tubesock.rb:63:in `block in listen'
```

The problem seems to be that Firefox is sending a strange/unexpected binary terminate signal (that is certainly not valid JSON). Research brought up [this line](https://github.com/salini/pydaenim/blob/master/src/core.py#L87), which I adopted.

Works for me, so I suggest using it.