nyarly / sockjs-ruby

WebSocket emulation - Ruby server
http://sockjs.org
MIT License
28 stars 5 forks source link

Websockets don't close properly #2

Open nyarly opened 11 years ago

nyarly commented 11 years ago

When an actual Websocket is closed from the browser (e.g. by closing the window) the server says:

~ WS#close(nil, nil, false) ~ Error closing websocket (#<Faye::WebSocket::API::Event:0xb1ac8d0 @): #<TypeError: Integer object expected, but object is an instance of NilClass (object: nil).>

And keeps sending heartbeats.

ShiningRay commented 11 years ago
C:/languages/Ruby193/lib/ruby/gems/1.9.1/gems/sockjs-0.2.1/lib/sockjs/protocol.r
b:40:in `validate': Integer object expected, but object is an instance of NilCla
ss (object: nil). (TypeError)

I also encountered this bug and fix it by modify transports/websocket.rb line 108 session.close to session.close(3000, 'Go away')