Home / Companies / Twilio / Blog / Post Details
Content Deep Dive

Real Time Rails 4: Using Server-Sent Events with Authy OneTouch

Blog post from Twilio

Post Details
Company
Date Published
Author
Phil Nash
Word Count
1,939
Language
English
Hacker News Points
-
Summary

This summary highlights the key points of using Server-Sent Events (SSE) with Rails 4 to implement real-time updates, specifically with Authy OneTouch. The author uses SSE to replace polling in a previous tutorial, enabling real-time updates from the server to the client without having to reload the page. To achieve this, they update the controller to use SSE and add a notification mechanism using PostgreSQL's publish-subscribe feature. The updated JavaScript code listens for SSE events instead of polling, providing a seamless user experience. The author notes that Rails 4 can perform real-time updates, but Action Cable in Rails 5 will provide two-way real-time streams for more complex interactions like chat rooms.