celluloid/celluloid-io — pull request #30 by slivu (2012-11-26 21:10:00+00:00)
Title: Added on_error/on_close callbacks

This will allow to execute user defined callbacks rather than raising exceptions.

A generic use case are the streaming bodies on `Reel`:

```ruby
body = Reel::EventStream.new do |socket|
@@connections << socket
socket.on_error { @@connections.delete socket }
end
```

Initially were thinking about to add these callbacks at `Reel` level but this turned to be cumbersome.