CableReady
Search…
Hello World
Minimum Viable CableReady
One of the most powerful aspects of CableReady is that it can be called from any part of your Rails application. Thanks to the new stream_from feature in CableReady v5, you can use it without any client configuration.
Drop a stream_from helper into your view whenever you need a Reactive UX:
1
<%= stream_from :foo %>
2
What does the agnostic, dyslexic insomniac do?
Copied!
Everyone looking at this page - or any other page which is subscribed to :foo - will instantly see an update when the following Ruby executes:
1
cable_ready[:foo]
2
.append("body", html: "They lay awake, wondering if there is a dog.")
3
.broadcast
Copied!
Your server-side code just dynamically updated text on potentially thousands of clients, without writing any boilerplate JavaScript or Ruby.
Jazz Hands
You could, in theory at least, already be done learning CableReady and just start using its 36 operations in your controllers, models, Reflexes and jobs. What a time to be alive! ✨
However, most developers will want to keep reading and learn how to use Channels.
Export as PDF
Copy link