small medium large xlarge

Real-Time Phoenix: Build Highly Scalable Systems with Channels


Cover image for Real-Time Phoenix

Real-Time Phoenix

Build Highly Scalable Systems with Channels


Give users the real-time experience they expect, by using Elixir and Phoenix Channels to build applications that instantly react to changes and reflect the application’s true state. Learn how Elixir and Phoenix make it easy and enjoyable to create real-time applications that scale to a large number of users. Apply system design and development best practices to create applications that are easy to maintain. Gain confidence by learning how to break your applications before your users do. Deploy applications with minimized resource use and maximized performance.

Choose Your Format(s)

  • $24.95 In Stock
    • Beta: What do I get?

  • Ebooks are DRM free.

  • Ebook delivery options.

About this Title

Pages: 326 (est)
Published: 2020-04-10
Release: B9.0 (2020-03-09)
ISBN: 978-1-68050-719-5

Real-time applications come with real challenges—persistent connections, multi-server deployment, and strict performance requirements are just a few. Don’t try to solve these challenges by yourself—use a framework that handles them for you. Elixir and Phoenix Channels provide a solid foundation on which to build stable and scalable real-time applications. Build applications that thrive for years to come with the best practices found in this book.

Understand the magic of real-time communication by inspecting the WebSocket protocol in action. Avoid performance pitfalls early in the development lifecycle with a catalog of common problems and their solutions. Leverage GenStage to build a data pipeline that improves scalability. Break your application before your users do and deploy with confidence. Build a real-world project using solid application design and testing practices that help make future changes a breeze. Create distributed apps that can scale to many users with tools like Phoenix Tracker. Deploy and monitor your application with confidence and reduce outages.

Deliver an exceptional real-time experience to your users, with easy maintenance, reduced operational costs, and maximized performance, using Elixir and Phoenix Channels.

What You Need

You’ll need Elixir 1.9+ and Erlang/OTP 22+ installed on a Mac OS X, Linux, or Windows machine.

Contents & Extracts

This book is currently in beta, so the contents and extracts will change as the book is developed.


  • Real-time is Now
    • The Case for Real-time Systems
    • The Layers of a Real-time System
    • Types of Scalability
    • Achieving Real-time in Elixir
    • Building Real-time Systems
    • Wrapping Up
  • Powering Real-time Applications with Phoenix
    • Connect a Simple WebSocket excerpt
      • Why WebSockets?
      • Connecting our First WebSocket
      • WebSocket Protocol
      • Long Polling, a Real-time Alternative
      • WebSockets and Phoenix Channels
      • Wrapping Up
    • First Steps with Phoenix Channels
      • What are Phoenix Channels?
      • Understanding Channel Structure
      • PubSub
      • Send and Receive Messages
      • Channel Clients
      • Wrapping Up
    • Restrict Socket and Channel Access
      • Why Restrict Access?
      • Add Authentication to Sockets
      • Add Authentication to Channels
      • Use Authentication from JavaScript
      • When to Write a New Socket
      • Wrapping Up
    • Dive Deep into Phoenix Channels
      • Design for Unreliable Connections
      • Use Channels in a Cluster excerpt
      • Customize Channel Behavior
      • Write Tests
      • Wrapping Up
    • Avoid Performance Pitfalls
      • Measure Everything
      • Keep Your Channels Asynchronous
      • Build a Scalable Data Pipeline
      • Wrapping Up
  • Building a Real-time Application
    • Build a Real-Time Sneaker Store
      • From Product Requirements to a Plan
      • Setup the Project
      • Render Real-time HTML with Channels excerpt
      • Update a Client with Real-time Data
      • Run Multiple Servers
      • Wrapping Up
    • Break Your Application with Confidence
      • The Challenge of Real-time Systems
      • Break Your App Like a User
      • Break Your App Like a Server
      • Automate User Acceptance Tests With Hound
      • Wrapping Up
    • Build a Real-Time Shopping Cart
    • Track Connected Users
  • Bringing Real-time Applications to Production
    • Deploy Your Application to Production
    • Manage Real-time Resources


Steve Bussey is a software architect at SalesLoft focused on delivering the best experience possible for sales people and also his fellow engineers. He has written and led development on real-time Elixir applications that power critical features of business software. He is passionate about sharing Elixir due to the positive impact it has had on how he designs and writes applications.