Mid-level Track Roadmap

Solid Cable: scaling WebSockets

This course follows one Turbo refresh broadcast through Solid Cable, the database-backed pub/sub adapter for Action Cable. It shows that broadcast_refresh_to is a synchronous write with no queue, and how the solid_cable_messages table stores each message with a signed 64-bit channel hash. It covers the listener thread that polls for new rows, its two watermarks and its shutdown semaphore. It explains the trim lottery that deletes expired rows, why polling cost grows with process count, and how to read a live cable table as evidence.

What you'll learn

  • ✓How broadcast_refresh_to writes synchronously through Action Cable with no queue
  • ✓The single solid_cable_messages table and its signed SHA256 channel hash
  • ✓How the listener thread polls, tracks watermarks and shuts down safely
  • ✓How the trim lottery deletes expired messages during broadcasts
  • ✓Why polling cost grows with the number of app server processes
  • ✓Reading row counts and id ranges in a live cable table
Free preview · Lesson 1 4 min read

broadcast_refresh_to is a synchronous write

Three files in this app call the same line. Admin::Catalog::SaveCourseService, Admin::Catalog::ReorderCourseService and Admin::Catalog::ReorderLessonService each end with Turbo::StreamsChannel.broadcast_refresh_to("catalog_roadmap"), and app/views/catalog/courses/index.html.erb opens with <%=…

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...