Server-side Ruby making magic happen on the client, in real-time
CableReady is a Ruby gem that was first released in May 2017. It lets you create great real-time user experiences by triggering client-side DOM changes, events and notifications over ActionCable web sockets. These commands are called operations.
Unlike Ajax requests, operations are not always initiated by user activity - or even the user's browser.
You can broadcast one or many operations at once from inside a Reflex, as well as ActiveRecord callbacks, ActiveJobs, ActionCable Channels, controller actions, rake tasks and in response to API calls and webhooks.
Perhaps you've grown tired of the ever-growing complexity of the JS ecosystem. Single Page Applications are frequently lauded as the only way to build "modern" sites... even though we remember how easily one person could build powerful sites with Rails in 2004.
Or maybe you've realized that trying to synchronize state between the client and server over a stateless protocol is a Sisyphean task. How much time and energy could we reclaim for more interesting problems if we didn't need to write complex branching UI logic to update what the user sees?
CableReady enables a radical new style of development, and it can make you literally 10x more productive than people who don't have it. Will you use your surplus for good... or for awesome?
- Build reactive UIs without client state 🥏
- Break free of the request-response lifecycle 🤹
- Increase functionality, not complexity 🪁
- Act as a force multiplier for StimulusJS 🔨
Since its release in late 2020, Rails developers have been eagerly digging into their new tooling. Inevitably, people ask how it stacks up to CableReady and StimulusReflex.
While any answer will be nuanced and biases controlled for, we see the Turbo eventually providing an excellent successor for Rails UJS and acting as a launchboard to Reactive Rails UI design.
Moreover, developers can use CableReady to broadcast operations to ad hoc groups of both people and resources in a way that enables developers to build applications not easily possible with other tools.
CableReady currently boasts 33 different operations that can be triggered from server-side Ruby code: