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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Miloš Mošić
May 30, 2019
Programming
390
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
710
Introduction to Erebos: a JavaScript client for Swarm
mosic
1
490
Elixir @ Evercam
mosic
3
1.6k
Other Decks in Programming
See All in Programming
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
360
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
160
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
210
これからAgentCoreを触る方へトレンドはGatewayです
har1101
6
480
AI がコードを書く時代における新卒エンジニアの仕事風景 (2026) / New Graduate Engineers in the Era of AI Coding (2026)
sushichan044
0
200
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
260
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
300
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
440
OS アップデート対応の取り組み方がもっと共有されてほしい
andpad
0
110
共通化で考えるべきは、実装より公開する型だった
codeegg
0
170
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
180
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
160
Featured
See All Featured
A better future with KSS
kneath
240
18k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
240
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
640
We Have a Design System, Now What?
morganepeng
55
8.2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.6k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
770
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
890
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Code Reviewing Like a Champion
maltzj
528
40k
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