Shower
Shower allows the creation of an unlimited number of event streams through a single connection! Server side events have never been easier and more efficient. Since there is no needed to persist a database connection, the amount of concurrent users is only limited by your Rails server.
The idea for this gem came from the development of Cryptocurrency Exchange Machine. There was a necessity to push currency price updates to the frontend in real-time. To accomplish this, I used Rails’ ActionController::Live. As this functionality was new to Rails 4 at the time, documentation and examples were sparse. After finally nailing down he functionality, I realized that this could and should be abstracted into a gem to make everyone else’s lives a little easier.
While porting this to a gem, a few other features were added. The included controller allows for a global pub/sub setup where each client defines the streams they want to listen to. In the backend, publishing data to any stream was simplified into a single method call. Finally, a small JavaScript class was included to handle the frontend subscriptions with only a few lines of code.