Chapter 22 Action Cable

Action Cable provides an easy way to add real-time, low-latency communication between the browser and your Rails 5 server backend, using a technology called web sockets. It eliminates the need for Ajax polling, or old-school, brute-force methods like this classic webmaster technique:

<meta http-equiv="refresh" content="5" />

Most importantly, it is well integrated into the rest of Rails and follows its conventions in a way that feels natural. DHH formally introduced it in his 2015 Railsconf keynote, alongside Rails API mode—both innovations represent ways that Ruby on Rails is staying relevant in the face of competition from the likes of React, Angular, and Firebase.

22.1 Web Sockets

Web ...

Get The Rails 5 Way, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.