Closed ghost closed 11 years ago
Well, I can explain a bit why it works that way. The idea is a bit similar to Rack hijack: once upgraded to a WebSocket, the WebSocket is in control of the socket, not the connection. The connection should not be used after that, and setting socket to nil
was flagging that fact.
I agree the semantics could be better here. I'm not sure I like your fix. I think the WebSocket should be the only object you're interacting with after the connection has been upgraded.
Not sure why
@socket
should benil
here... https://github.com/celluloid/reel/blob/master/lib/reel/connection.rb#L60It is there since v0.2.0.pre (read before my updates :)) https://github.com/celluloid/reel/blob/v0.2.0.pre/lib/reel/connection.rb#L62
No time to investigate why it should be
nil
, but setting it to actualWebSocket
instance result into Stream Closed exception.As a workaround we can store
WebSocket
instance into@websocket
instance variable and use it instad of@socket
on websocket requests?This is fixing #60
Makes sense?