a lesson, contribute a TIL (or longer!) blog post or provide a translation. Open an issue here describing your idea or simply open a PR with your work to get started. 6
can see other users in the “estimation room” in real-time ◦ Users can vote on tickets ◦ Users can see the winning vote tallied in real-time and move on to the next ticket 9
the first card for estimation appears for all users in the room Features Real-Time User Presence When a new user joins/leaves Then I see the list of present users update in the UI 12
I see the UI update to indicate they have voted Features Winner is Calculated When the last user submits a vote Then all users see the winning vote And a user can click “next card” 13
the server as soon as it is available—no request required This represents a significant departure from traditional HTTP communication Made possible by WebSockets 16
send a message over the socket to the LiveView process • The LiveView process will update its state and push a message back down the socket • The leex template will re-render with the new state 31
CardController mounts the LiveView • The LiveView renders the LEEX template as static HTML • A JS snippet on that static HTML page sends the “WebSocket connect” request 52
CardController mounts the LiveView • The LiveView renders the LEEX template as static HTML • A JS snippet on that static HTML page sends the “WebSocket connect” request • The LiveView process re-renders the template over WebSockets, is now listening for events from the client 53
def render(assigns) do Phoenix.View.render(CardView, "index.html", assigns) end def mount(_session, socket) do {:ok, assign(socket, is_pointing: false)} end end
a LiveView and LEEX template - We did this for you :) • Render the LiveView from the controller - We did this for you :) Handle Events • Add a phx-click event to the “start pointing” button • Define a handle_event/3 function to match this event and update socket.assigns accordingly Configure LiveView • We did this for you :)
subscribe Elixir processes to a shared topic and publish messages to those processes. Phoenix Channels abstract away the interactions with Phoenix PubSub, but you can also use the PubSub library directly, which is exactly what we’ll do from within our LiveView. 100
• Register a process under a given topic • Store that info in a decentralized and resilient data store. • Broadcast presence-related events and sync presence data with ease. 116
have to send all data through a central server. It also gives you resilience to failure because the system automatically recovers from failures. - Chris McCord 119
do check all number <- StreamData.integer(), row_index = abs(number) do element_count = length(Pascal.row(row_index)) assert element_count == row_index + 1 end end 159
symmetrical ◦ The first and last elements of each row are 1 ◦ After row 0, the second element in each list is the row index 170 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 …
symmetrical ◦ The first and last elements of each row are 1 ◦ After row 0, the second element in each list is the row index ◦ So is the second-to-last element 171 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 …
any row as a list ◦ Row 0 just has one element: 1 ◦ For all rows after 0, 1 appears twice ◦ Each row n has n+1 elements in it 175 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 …
any row as a list ◦ Row 0 just has one element: 1 ◦ For all rows after 0, 1 appears twice ◦ Each row n has n+1 elements in it ◦ In each row, numbers go up, then down 176 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 …
◦ “Choosing properties for property-based testing” by Scott Wlaschin ◦ Property-Based Testing with PropEr, Erlang, and Elixir and PropEr Testing by Fred Hebert ◦ SteamData documentation ◦ “Testing the Hard Stuff and Staying Sane” by John Hughes ◦ “Picking Properties to Test in Property Based Testing” by Michael Stalker 187