Skip to Content
Phoenix Web Development
book

Phoenix Web Development

by Brandon Richey
April 2018
Beginner to intermediate content levelBeginner to intermediate
406 pages
9h 33m
English
Packt Publishing
Content preview from Phoenix Web Development

Refactoring our channels away from the index

We have our WebSockets running on the index page for our Polls, but that'll actually be very difficult for us to support in the future, especially if we want to add anything like per-poll chat options or another similar feature that relies very specifically on the display of a single poll. Because of that, let's take a few minutes to implement a show action and template for our poll, and move our socket code there instead! We'll also have to change some of the topics that we were previously relying on since right now we're using the lobby as the identifier for the polls channels. We'll instead want to switch that over to be more along the lines of: "polls:(poll id)". First, hop on over to lib/vocial_web/router.ex ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Phoenix in Action

Phoenix in Action

Geoffrey Lessel
Real-Time Phoenix

Real-Time Phoenix

Stephen Bussey

Publisher Resources

ISBN: 9781787284197Supplemental Content