socketry/cool.io
FreeSimple evented I/O for Ruby (but please check out Celluloid::IO instead)
About socketry/cool.io
Cool.io is an event-driven I/O library for Ruby, built on the high-performance libev event library. It provides cross-platform support for system calls such as epoll (Linux), kqueue (BSD/macOS), and completion ports (Solaris). The library offers a simple API with core classes like Cool.io::Loop for the event loop and Cool.io::Watcher for observing events. It includes several watcher types: IOWatcher (for readable/writable I/O), TimerWatcher (for timed events), StatWatcher (for file/directory monitoring), and AsyncWatcher (for cross-thread signaling). Additionally, Cool.io provides asynchronous wrappers for Ruby's socket classes, including Cool.io::TCPSocket with buffered I/O and non-blocking connect. Note: the project's GitHub description suggests checking out Celluloid::IO as an alternative.
Key Features
Pros & Cons
- High performance through native system calls (epoll, kqueue) via libev
- Cross-platform compatibility across Linux, BSD, macOS, and Solaris
- Simple and clear API for event-driven programming in Ruby
- Includes asynchronous wrappers for Ruby's core socket classes to simplify non-blocking I/O
- Ruby-specific; not usable from other languages
- Project may be superseded by Celluloid::IO, as noted in the repository description
- Limited documentation beyond the basic README