Chapter 5Streaming Server Events to Clients Asynchronously

  • Rails engines

  • Rails live-streaming functionality

  • Ruby threads and queues

  • Eager loading of code in Rails

In the previous chapters, we analyzed the Rails rendering stack inside and out. You learned that when a request reaches a controller, the controller gathers the required information to render a template. The template is retrieved from one of the resolvers, compiled, rendered fully, and embedded in a layout. At the end of this process, you have a Ruby string representing this template. The string is set as the HTTP response and sent back to the client.

This approach works fine for the vast majority of applications. However, in some cases we need to send our response in smaller chunks. ...

Get Crafting Rails 4 Applications, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.