Real-time Phoenix (Pragprog)

Blockquote I’m going to think about how to approach this. I don’t think I’m equipped to add examples of using it with Elm, but I may be able to provide something for VueJs and friends. A lot of it will have to do with timing and my availability.

I hope it would be VueJS :smiley:


React would be awesome. Just got the book, excited!

Hey y’all. The third beta just released with chapter 9.

We build a user-specific shopping cart in this chapter—It’s the most advanced usage of Channels in the book and covers many of the challenges seen in past chapters. Also, there’s cool shoe images now (but I can’t upload a screenshot right now for some reason)!

Chapter 10 is in the queue as well—it should be a fast follow. That chapter will cover Tracker / Presence to build an admin dashboard.


Hi folks,
Is anyone working through the code in the book? I have started but am having limited success. Since Pragprog does not allow discussions, would this be the place to share thoughts? I’m on page 34 and getting unmatched topic warnings:

> $ wscat -c 'ws://localhost:4000/socket/websocket?vsn=2.0.0'
> Connected (press CTRL+C to quit)
> > ["1","1","ping","phx_join",{}]
> < [null,"1","ping","phx_reply",{"response":{"reason":"unmatched topic"},"status":"error"}]
> Disconnected (code: 1000)


1 Like

Hey Mike

Did you add the channel to the UserSocket on page 32? A complete code for hello_sockets distributes with the book and may help here.


Thanks for the quick response, Steve. I restarted my server, and it picked up the channel. Getting a correct response now. I shall forge ahead. Running on Manjaro linux with Firefox Developer beta. The messages tab in the dev tools view is not working so far.


FYI, I moved to the unstable branch and the messages tab works in 71.0b7 of Firefox Developer.

1 Like

Thanks for sharing. I’m honestly not sure what’s up with this. I have been using Chrome exclusively, and I originally checked in Firefox that this all worked as expected. I’m glad it’s working in the latest version (although not main yet).

Chrome recently had some weird WebSocket issues as well.

1 Like

Thanks for writing this book! I’ve been waiting for one like this for awhile now.


We shipped chapter 10 to beta, and 11-13 are in editor review. 10 is about using Tracker/Presence. We build an admin UI for the store and use Presence for knowing how many of each shoes are in carts.

Chapter 13 is a LiveView chapter (it wasn’t in the original ToC as we were working out how to include it).


Thanks for releasing part 2 of the book.

I would like to ask You if using one product channel, instead of one channel per product is also a viable option. Each message being tagged with product_id.

I do understand it solves different problems, but my concern is about the number of products, and thus, the numbers of channels You need to open (for a catalog that could 10k-100k products).

Thanks for taking time.

1 Like

Definitely! The reason I went with the multi channel approach is to hide information a bit. Also, to reduce the number of messages going out to users.

Let’s say that you have 1000 products represented by a single topic. If any of those products would change, every current visitor would receive the message. This could end up being a lot of additional data transfer in a high traffic store. It’s all a trade-off though. It’s arguably a simpler design and so development and maintenance efforts will be less. Many people would opt for this.

I don’t think either solution is wrong unless it proves itself to not work in the context of what you’re doing.

1 Like

Alright, a little update.

The deployment chapter (11) just went into beta. There’s some neat stuff to think about with load balancing here. Part III will be fairly standalone and you could read it without the rest of the book if you want.

The next 2 chapters (Managing Production Resources and Hands-On With Phoenix LiveView) are going to be releasing soon, although the holidays may delay them a bit.

We’re adding another chapter on single-page apps. I’m probably going to focus on React only here because the important part is using a component based library, and also React works with Native. I haven’t fully decided yet. The React example will probably be standalone though, and not tied into the rest of the book’s example.

- Steve


Anyone else having an issue opening the B5.0 ePub file with Books on iOS ? Not sure if it’s related to the formatting issues I’m seeing.

​ ​# cURL command abbreviated, paste your copied command​
​ ​# Include all of the headers that came with the copied command​
​ ​$ ​​curl​​ ​​-i​​ ​​'http://localhost:4000/socket/websocket?vsn=2.0.0’​​ ​​-H…​
​ HTTP/1.1 101 Switching Protocols
​ connection: Upgrade
​ date: Fri, 12 Apr 2019 01:29:18 GMT
​ sec-websocket-accept: afAAVeJV/iyu1ZxFEE6HMzL0ha0=
​ server: Cowboy
​ upgrade: websocket

Hey that’s definitely strange. I checked out B5.0 ePub on Books (iOS 13.1.3) and that page looks correct to me. I wonder if yours somehow generated incorrectly, or if it’s using a font that’s not on your device for some reason. Is there a re-download option?

Regenerating the ePub file did the trick.

Alright, Merry Christmas and Happy Holidays folks. The B6.0 release just went out today.

Chapter 12 dives into BEAM Scheduler and Garbage Collection basics. You’ll also see an example of how to use the Observer CLI program to view stats of a live BEAM node.

Chapters 13 and 14 are in the hopper and going through review. I imagine we’ll keep with a 2 week schedule for these.

Regarding Kindle formatting issue—I have an open item to convert the figures so that the text appears on Kindle. Hopefully that will be in the next beta.


Hey everyone

The final chapters are out in beta. LiveView and React—it’s pretty fun!

The Kindle image issue is fixed in the latest release. I verified locally with an epub reader but I don’t have a proper eink Kindle. If you see any issues with the images, feel free to @me directly or make an errata.

That’s it for now! The book is having some final changes and will then go into the final production process.



Congratulation and thank you! The betas have been great to follow and it’s an incredibly useful book and I love that we are starting to get some more advanced and in-depth books written for Elixir now.

1 Like

When is it approximately out in its final version? I will buy it straight away.