Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Phoenix LiveView - Making modern web apps witho...
Search
Miloš Mošić
May 30, 2019
Programming
400
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Phoenix LiveView - Making modern web apps without JavaScript
https://www.meetup.com/elixirbelgrade/events/261344984/
Miloš Mošić
May 30, 2019
More Decks by Miloš Mošić
See All by Miloš Mošić
Elixir_and_Blockchain_-_a_Perfect_Match.pdf
mosic
0
720
Introduction to Erebos: a JavaScript client for Swarm
mosic
1
500
Elixir @ Evercam
mosic
3
1.6k
Other Decks in Programming
See All in Programming
Cloudflare is Agents
chimame
0
190
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
400
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
450
言葉の格闘技のススメ~紙とペンと言葉から始める、キャリアの描き方~
progresscicada
2
190
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
690
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
240
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
5
1.8k
初めての模倣学習とVLA
natsutan
0
330
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
130
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
3
460
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
130
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
120
Featured
See All Featured
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
57k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
500
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
480
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
230
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
460
Mobile First: as difficult as doing things right
swwweet
225
10k
sira's awesome portfolio website redesign presentation
elsirapls
0
360
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
460
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Transcript
Phoenix LiveView: Making modern web apps without JavaScript Miloš Mošić
https://milosmosic.com 1 / 27
Who am I? 2 / 27
Who am I? Senior Software Engineer at Mainframe 3 /
27
Who am I? Senior Software Engineer at Mainframe Worked with
Elixir & Phoenix since 2014 4 / 27
Who am I? Senior Software Engineer at Mainframe Worked with
Elixir & Phoenix since 2014 Helped spread Elixir by introducing it into Evercam 5 / 27
Who am I? Senior Software Engineer at Mainframe Worked with
Elixir & Phoenix since 2014 Helped spread Elixir by introducing it into Evercam Gave a talk at the first Elixir Conf EU 6 / 27
What is Elixir? 7 / 27
What is Phoenix? 8 / 27
What is Phoenix LiveView? 9 / 27
What is Phoenix LiveView? A brand new library for Phoenix
10 / 27
What is Phoenix LiveView? A brand new library for Phoenix
Made by the Phoenix creator, Chris McCord 11 / 27
What is Phoenix LiveView? A brand new library for Phoenix
Made by the Phoenix creator, Chris McCord Not released yet 12 / 27
What is Phoenix LiveView? 13 / 27
What would you use Phoenix LiveView for? 14 / 27
Killing JavaScript 15 / 27
How does it work? 16 / 27
Simple example 17 / 27
defmodule DemoWeb.ImageView do use Phoenix.LiveView def render(assigns) do ~L""" <form
phx-change="update"> <input type="range" min="10" max="630" name="width" value="<%= @width %>" /> <%= @width %>px <fieldset> White <%= radio_tag(name: :bg, value: "white", checked: @bg) %> Black <%= radio_tag(name: :bg, value: "black", checked: @bg) %> Blue <%= radio_tag(name: :bg, value: "blue", checked: @bg) %> </fieldset> </form> <br/> <img src="/images/phx.png" width="<%= @width %>" style="background: <%= @bg %>;" /> """ end def radio_tag(assigns) do ~L""" <input type="radio" name="<%= @name %>" value="<%= @value %>" <%= if @value == @checked, do: "checked" %> /> """ end def mount(_session, socket) do {:ok, assign(socket, width: 100, bg: "white")} end def handle_event("update", %{"width" => width, "bg" => bg}, socket) do {:noreply, assign(socket, width: String.to_integer(width), bg: bg)} end end 18 / 27
def deps do [ {:phoenix_live_view, github: "phoenixframework/phoenix_live_view"} ] end https://github.com/phoenixframework/phoenix_live_view
19 / 27
defmodule DemoWeb.ImageView do use Phoenix.LiveView end 20 / 27
def render(assigns) do ~L""" <form phx-change="update"> <input type="range" min="10" max="630"
name="width" value="<%= @width %>" /> <%= @width %>px <fieldset> White <%= radio_tag(name: :bg, value: "white", checked: @bg) %> Black <%= radio_tag(name: :bg, value: "black", checked: @bg) %> Blue <%= radio_tag(name: :bg, value: "blue", checked: @bg) %> </fieldset> </form> <br/> <img src="/images/phx.png" width="<%= @width %>" style="background: <%= @bg %>;" /> """ end 21 / 27
def radio_tag(assigns) do ~L""" <input type="radio" name="<%= @name %>" value="<%=
@value %>" <%= if @value == @checked, do: "checked" %> /> """ end def mount(_session, socket) do {:ok, assign(socket, width: 100, bg: "white")} end def handle_event("update", %{"width" => width, "bg" => bg}, socket) do {:noreply, assign(socket, width: String.to_integer(width), bg: bg)} end 22 / 27
Example one more time 23 / 27
How does it work? 24 / 27
Wait, holding an open websocket connection for every single page?
25 / 27
https://phoenixframework.org/blog/the-road-to-2-million-websocket-connections 26 / 27
Thank You! Questions? 27 / 27