faye / websocket-driver-ruby

WebSocket protocol handler with pluggable I/O
Other
223 stars 43 forks source link

driver doesn't notice SSLSocket close under Celluloid #42

Closed dblock closed 8 years ago

dblock commented 8 years ago

From https://github.com/celluloid/celluloid-io/issues/176 (repro code in the issue). I am not sure whether this is a websocket-driver-ruby problem or celluloid-io, but this works with EventMachine as expected. Under Celluloid when the socket closes the driver sees a :close event when the server closes the connection.

jcoglan commented 8 years ago

websocket-driver doesn't know anything about sockets and certainly doesn't know how to listen for them closing, whichever I/O framework you're using. Your integration with Celluloid needs to listen for the socket being closed and emit an event accordingly. This event does not actually involve the driver since it's not related to data being transferred as part of the protocol.

jcoglan commented 8 years ago

For example, faye-websocket listens for the client TCP/TLS socket being closed:

https://github.com/faye/faye-websocket-ruby/blob/c6403578831822433a3cee7113d2c40677ae23fb/lib/faye/websocket/client.rb#L75

and emits its own event without invoking the driver:

https://github.com/faye/faye-websocket-ruby/blob/c6403578831822433a3cee7113d2c40677ae23fb/lib/faye/websocket/api.rb#L129

dblock commented 8 years ago

I see. So clearly this is something missing in celluloid-io. Thans @jcoglan, I'll close this.