Rails 7 #121 Turbo Broadcasts CRUD Demystified
There are two different ways of serving Turbo Streams
via HTTP and via Websockets. The regular HTTP streams send updates ONLY to the user that performed an action, whereas Websocket streams (aka Broadcasts) send updates TO ALL users that are
subscribed to a channel.
in Episode 59 we did an in-deep dive into HTTP Turbo Streams.
Now we will dive into the magic beneath Turbo Stream Broadcasts and understand the best practices while working with them.
Broadcaster pattern for Turbo Streams Broadcasts: https://blog.corsego.com/turbo-broadcast-renderer-pattern
Based on this blogpost: https://blog.corsego.com/turbo-hotwire-broadcasts
2:22 Basic Turbo Broadcast from model
5:38 Demistify broadcast_to
7:39 Demistify broadcast_action_to
10:15 Broadcast posts count on create and destroy as HTML
13:31 Broadcast posts count as a partial
14:20 Invoke Broadcasts from Controller, not Model
18:32 Broadcaster pattern. Invoke Broadcasts from Console