SlideShare a Scribd company logo
1 of 21
Phoenix LiveView
Web interactif côté serveur
Architecture initiale
HTML + JS
Serveur web
Navigateur
Application Javascript
HTML JSON
HTML + JS
Framework Javascript
Une autre approche?
HTML + JS
Websocket
Phoenix LiveView
Elixir
Phoenix
Websockets
Code d’une LiveView
defmodule MyAppWeb.HelloWorldLive do
use Phoenix.LiveView
def mount(_session, socket) do
{:ok, assign(socket, message: "Hello WAQ!!!")}
end
def render(assigns) do
~L"""
<div>Message: <%= @message %></div>
"""
end
end
Code d’une LiveView
defmodule MyAppWeb.HelloWorldLive do
use Phoenix.LiveView
def mount(_session, socket) do
{:ok, assign(socket, message: "Hello WAQ!!!")}
end
def render(assigns) do
~L"""
<div>Message: <%= @message %></div>
"""
end
end
Code d’une LiveView
defmodule MyAppWeb.HelloWorldLive do
use Phoenix.LiveView
def mount(_session, socket) do
{:ok, assign(socket, message: "Hello WAQ!!!")}
end
def render(assigns) do
~L"""
<div>Message: <%= @message %></div>
"""
end
end
Utiliser une LiveView
# Template
<%= Phoenix.LiveView.live_render(@conn, DemoWeb.HelloWorldLive ) %>
# Routeur
live "/hello", DemoWeb.HelloWorldLive
# Controlleur
Phoenix.LiveView.Controller.live_render(conn, DemoWeb.HelloWorldLive )
Ajouter de l’interactivité
def render(assigns) do
~L"""
<div>Message: <%= @message %></div>
<button phx-click="add_message">
Ajouter WAQ!!!
</button>
"""
end
def handle_event("add_message", _value, socket) do
message = socket.assigns.message <> "WAQ!!!"
{:noreply, assign(socket, message: message)}
end
Ajouter de l’interactivité
def render(assigns) do
~L"""
<div>Message: <%= @message %></div>
<button phx-click="add_message">
Ajouter WAQ!!!
</button>
"""
end
def handle_event("add_message", _value, socket) do
message = socket.assigns.message <> "WAQ!!!"
{:noreply, assign(socket, message: message)}
end
Fonctionnement
GET /home
HTML + JS
liveSocket.connect()
Socket connecté
phx-click
Fragments HTML
Réponse serveur
["1", "4", "lv:phx-FHOaenCt", "phx_reply", {
"response": {
"diff": {
"0": "Hello WAQ!!!WAQ!!!WAQ!!!"
}
},
"status": "ok"
}]
Partager des informations entre les utilisateurs
def mount(_session, socket) do
Phoenix.PubSub.subscribe(MyApp.PubSub, "topic")
{:ok, assign(socket, message: "Hello WAQ!!!" )}
end
def handle_info(%{message: message}, socket) do
{:noreply, assign(socket, message: message)}
end
def handle_event("add_message", _value, socket) do
message = socket.assigns.message <> "WAQ!!!"
Phoenix.PubSub.broadcast(MyApp.PubSub, "topic", %{message: message})
{:noreply, socket}
end
Partager des informations entre les utilisateurs
def mount(_session, socket) do
Phoenix.PubSub.subscribe(MyApp.PubSub, "topic")
{:ok, assign(socket, message: "Hello WAQ!!!")}
end
def handle_info(%{message: message}, socket) do
{:noreply, assign(socket, message: message)}
end
def handle_event("add_message", _value, socket) do
message = socket.assigns.message <> "WAQ!!!"
Phoenix.PubSub.broadcast(MyApp.PubSub, "topic", %{message: message})
{:noreply, socket}
end
Partager des informations entre les utilisateurs
def mount(_session, socket) do
Phoenix.PubSub.subscribe(MyApp.PubSub, "topic")
{:ok, assign(socket, message: "Hello WAQ!!!")}
end
def handle_info(%{message: message}, socket) do
{:noreply, assign(socket, message: message)}
end
def handle_event("add_message", _value, socket) do
message = socket.assigns.message <> "WAQ!!!"
Phoenix.PubSub.broadcast(MyApp.PubSub, "topic", %{message: message})
{:noreply, socket}
end
Résultat
Avantages
Simple
Performant
Temps réel
Limitations
Pas de “hors-ligne”
Latence
Mémoire serveur
Cas d’utilisation
Formulaires dynamiques
Tableaux de bord
Outils collaboratifs
Jeux multijoueur
Conclusion
HTML + JS
Websocket

More Related Content

What's hot

Wykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w LaraveluWykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w LaraveluLaravel Poland MeetUp
 
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史Shengyou Fan
 
Build RESTful API Using Express JS
Build RESTful API Using Express JSBuild RESTful API Using Express JS
Build RESTful API Using Express JSCakra Danu Sedayu
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perldeepfountainconsulting
 
Building Web Apps with Express
Building Web Apps with ExpressBuilding Web Apps with Express
Building Web Apps with ExpressAaron Stannard
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and othersYusuke Wada
 
Building websites with Node.ACS
Building websites with Node.ACSBuilding websites with Node.ACS
Building websites with Node.ACSRicardo Alcocer
 
WordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwaltenWordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwaltenWalter Ebert
 
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)Scrum Breakfast Vietnam
 
Introduction to node.js
Introduction to  node.jsIntroduction to  node.js
Introduction to node.jsMd. Sohel Rana
 
8 Minutes On Rack
8 Minutes On Rack8 Minutes On Rack
8 Minutes On Rackdanwrong
 
Advanced WordPress Development Environments
Advanced WordPress Development EnvironmentsAdvanced WordPress Development Environments
Advanced WordPress Development EnvironmentsBeau Lebens
 
Async Tasks with Django Channels
Async Tasks with Django ChannelsAsync Tasks with Django Channels
Async Tasks with Django ChannelsAlbert O'Connor
 
Serverless Ballerina
Serverless BallerinaServerless Ballerina
Serverless BallerinaBallerina
 
20150727 Development tools for Firefox OS apps
20150727 Development tools for Firefox OS apps20150727 Development tools for Firefox OS apps
20150727 Development tools for Firefox OS appsNoritada Shimizu
 
Running node.js as a service behind nginx/varnish
Running node.js as a service behind nginx/varnishRunning node.js as a service behind nginx/varnish
Running node.js as a service behind nginx/varnishthiagoalessio
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmusBram Vogelaar
 

What's hot (20)

Wykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w LaraveluWykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w Laravelu
 
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
 
Build RESTful API Using Express JS
Build RESTful API Using Express JSBuild RESTful API Using Express JS
Build RESTful API Using Express JS
 
Write php deploy everywhere tek11
Write php deploy everywhere   tek11Write php deploy everywhere   tek11
Write php deploy everywhere tek11
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perl
 
Building Web Apps with Express
Building Web Apps with ExpressBuilding Web Apps with Express
Building Web Apps with Express
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and others
 
Building websites with Node.ACS
Building websites with Node.ACSBuilding websites with Node.ACS
Building websites with Node.ACS
 
WordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwaltenWordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwalten
 
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)
 
A Gentle Introduction to Event Loops
A Gentle Introduction to Event LoopsA Gentle Introduction to Event Loops
A Gentle Introduction to Event Loops
 
Introduction to node.js
Introduction to  node.jsIntroduction to  node.js
Introduction to node.js
 
Introduction to Flask Micro Framework
Introduction to Flask Micro FrameworkIntroduction to Flask Micro Framework
Introduction to Flask Micro Framework
 
8 Minutes On Rack
8 Minutes On Rack8 Minutes On Rack
8 Minutes On Rack
 
Advanced WordPress Development Environments
Advanced WordPress Development EnvironmentsAdvanced WordPress Development Environments
Advanced WordPress Development Environments
 
Async Tasks with Django Channels
Async Tasks with Django ChannelsAsync Tasks with Django Channels
Async Tasks with Django Channels
 
Serverless Ballerina
Serverless BallerinaServerless Ballerina
Serverless Ballerina
 
20150727 Development tools for Firefox OS apps
20150727 Development tools for Firefox OS apps20150727 Development tools for Firefox OS apps
20150727 Development tools for Firefox OS apps
 
Running node.js as a service behind nginx/varnish
Running node.js as a service behind nginx/varnishRunning node.js as a service behind nginx/varnish
Running node.js as a service behind nginx/varnish
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmus
 

Similar to Frédérick Capovilla

Java FX 2.0 - A Developer's Guide
Java FX 2.0 - A Developer's GuideJava FX 2.0 - A Developer's Guide
Java FX 2.0 - A Developer's GuideStephen Chin
 
HTML5 vs Silverlight
HTML5 vs SilverlightHTML5 vs Silverlight
HTML5 vs SilverlightMatt Casto
 
JavaFX GUI architecture with Clojure core.async
JavaFX GUI architecture with Clojure core.asyncJavaFX GUI architecture with Clojure core.async
JavaFX GUI architecture with Clojure core.asyncFalko Riemenschneider
 
Enhancing Mobile User Experience with WebSocket
Enhancing Mobile User Experience with WebSocketEnhancing Mobile User Experience with WebSocket
Enhancing Mobile User Experience with WebSocketMauricio "Maltron" Leal
 
Web Components With Rails
Web Components With RailsWeb Components With Rails
Web Components With RailsBoris Nadion
 
2015-10-07 PPDC HTTP Adapters
2015-10-07 PPDC HTTP Adapters2015-10-07 PPDC HTTP Adapters
2015-10-07 PPDC HTTP Adaptersawwaiid
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkIndicThreads
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Frameworkvhazrati
 
Composer for busy developers - DPC13
Composer for busy developers - DPC13Composer for busy developers - DPC13
Composer for busy developers - DPC13Rafael Dohms
 
Going real time with Socket.io
Going real time with Socket.ioGoing real time with Socket.io
Going real time with Socket.ioArnout Kazemier
 
Visage Android - Cleaner APIs, Cleaner UIs
Visage Android - Cleaner APIs, Cleaner UIsVisage Android - Cleaner APIs, Cleaner UIs
Visage Android - Cleaner APIs, Cleaner UIsStephen Chin
 
Ruby MVC from scratch with Rack
Ruby MVC from scratch with RackRuby MVC from scratch with Rack
Ruby MVC from scratch with RackDonSchado
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Againjonknapp
 
Jax ws
Jax wsJax ws
Jax wsF K
 

Similar to Frédérick Capovilla (20)

5.node js
5.node js5.node js
5.node js
 
Node.js vs Play Framework
Node.js vs Play FrameworkNode.js vs Play Framework
Node.js vs Play Framework
 
Java FX 2.0 - A Developer's Guide
Java FX 2.0 - A Developer's GuideJava FX 2.0 - A Developer's Guide
Java FX 2.0 - A Developer's Guide
 
HTML5 vs Silverlight
HTML5 vs SilverlightHTML5 vs Silverlight
HTML5 vs Silverlight
 
JavaFX GUI architecture with Clojure core.async
JavaFX GUI architecture with Clojure core.asyncJavaFX GUI architecture with Clojure core.async
JavaFX GUI architecture with Clojure core.async
 
Enhancing Mobile User Experience with WebSocket
Enhancing Mobile User Experience with WebSocketEnhancing Mobile User Experience with WebSocket
Enhancing Mobile User Experience with WebSocket
 
React native by example by Vadim Ruban
React native by example by Vadim RubanReact native by example by Vadim Ruban
React native by example by Vadim Ruban
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
Web Components With Rails
Web Components With RailsWeb Components With Rails
Web Components With Rails
 
2015-10-07 PPDC HTTP Adapters
2015-10-07 PPDC HTTP Adapters2015-10-07 PPDC HTTP Adapters
2015-10-07 PPDC HTTP Adapters
 
Overview Of Lift Framework
Overview Of Lift FrameworkOverview Of Lift Framework
Overview Of Lift Framework
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Framework
 
WebSockets in JEE 7
WebSockets in JEE 7WebSockets in JEE 7
WebSockets in JEE 7
 
Composer for busy developers - DPC13
Composer for busy developers - DPC13Composer for busy developers - DPC13
Composer for busy developers - DPC13
 
Going real time with Socket.io
Going real time with Socket.ioGoing real time with Socket.io
Going real time with Socket.io
 
Visage Android - Cleaner APIs, Cleaner UIs
Visage Android - Cleaner APIs, Cleaner UIsVisage Android - Cleaner APIs, Cleaner UIs
Visage Android - Cleaner APIs, Cleaner UIs
 
Ruby MVC from scratch with Rack
Ruby MVC from scratch with RackRuby MVC from scratch with Rack
Ruby MVC from scratch with Rack
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Again
 
Jax ws
Jax wsJax ws
Jax ws
 

More from Web à Québec

Guillaume Labbé-Morissette
Guillaume Labbé-MorissetteGuillaume Labbé-Morissette
Guillaume Labbé-MorissetteWeb à Québec
 
Cynthia Thibault-Larouche
Cynthia Thibault-LaroucheCynthia Thibault-Larouche
Cynthia Thibault-LaroucheWeb à Québec
 
Intelligence artificielle, Données massives et Internet des objets: Quels son...
Intelligence artificielle, Données massives et Internet des objets: Quels son...Intelligence artificielle, Données massives et Internet des objets: Quels son...
Intelligence artificielle, Données massives et Internet des objets: Quels son...Web à Québec
 
So you want to be a service designer - Jamin Hegeman
So you want to be a service designer - Jamin HegemanSo you want to be a service designer - Jamin Hegeman
So you want to be a service designer - Jamin HegemanWeb à Québec
 
AI & the future of the political party - Colin Megill
AI & the future of the political party - Colin MegillAI & the future of the political party - Colin Megill
AI & the future of the political party - Colin MegillWeb à Québec
 
comment le Canada peut Gagner dans le secteur du numérique - Alex Benay
comment le Canada peut Gagner dans le secteur du numérique - Alex Benay comment le Canada peut Gagner dans le secteur du numérique - Alex Benay
comment le Canada peut Gagner dans le secteur du numérique - Alex Benay Web à Québec
 
Rendre son équipe performante : plus simple qu'on le pense - Louis-Philippe C...
Rendre son équipe performante : plus simple qu'on le pense - Louis-Philippe C...Rendre son équipe performante : plus simple qu'on le pense - Louis-Philippe C...
Rendre son équipe performante : plus simple qu'on le pense - Louis-Philippe C...Web à Québec
 
Turning Research Ripples Into Waves: Growing UX Research Capacity Through Col...
Turning Research Ripples Into Waves: Growing UX Research Capacity Through Col...Turning Research Ripples Into Waves: Growing UX Research Capacity Through Col...
Turning Research Ripples Into Waves: Growing UX Research Capacity Through Col...Web à Québec
 
Complexité et systèmes opérables - Fred Hébert
Complexité et systèmes opérables - Fred HébertComplexité et systèmes opérables - Fred Hébert
Complexité et systèmes opérables - Fred HébertWeb à Québec
 
Designing brands that last - Ben Hulse
Designing brands that last - Ben Hulse Designing brands that last - Ben Hulse
Designing brands that last - Ben Hulse Web à Québec
 

More from Web à Québec (20)

Kevin Bélanger
Kevin BélangerKevin Bélanger
Kevin Bélanger
 
Gabriel LeBreton
Gabriel LeBretonGabriel LeBreton
Gabriel LeBreton
 
Rémi Prévost
Rémi PrévostRémi Prévost
Rémi Prévost
 
Ludivine Durand
Ludivine DurandLudivine Durand
Ludivine Durand
 
Julie Simard
Julie SimardJulie Simard
Julie Simard
 
Guillaume Labbé-Morissette
Guillaume Labbé-MorissetteGuillaume Labbé-Morissette
Guillaume Labbé-Morissette
 
Katherine Mailloux
Katherine MaillouxKatherine Mailloux
Katherine Mailloux
 
Denis Martel
Denis MartelDenis Martel
Denis Martel
 
Charles Davignon
Charles DavignonCharles Davignon
Charles Davignon
 
Cynthia Thibault-Larouche
Cynthia Thibault-LaroucheCynthia Thibault-Larouche
Cynthia Thibault-Larouche
 
Louis-André Labadie
Louis-André LabadieLouis-André Labadie
Louis-André Labadie
 
Christophe Clouzeau
Christophe ClouzeauChristophe Clouzeau
Christophe Clouzeau
 
Intelligence artificielle, Données massives et Internet des objets: Quels son...
Intelligence artificielle, Données massives et Internet des objets: Quels son...Intelligence artificielle, Données massives et Internet des objets: Quels son...
Intelligence artificielle, Données massives et Internet des objets: Quels son...
 
So you want to be a service designer - Jamin Hegeman
So you want to be a service designer - Jamin HegemanSo you want to be a service designer - Jamin Hegeman
So you want to be a service designer - Jamin Hegeman
 
AI & the future of the political party - Colin Megill
AI & the future of the political party - Colin MegillAI & the future of the political party - Colin Megill
AI & the future of the political party - Colin Megill
 
comment le Canada peut Gagner dans le secteur du numérique - Alex Benay
comment le Canada peut Gagner dans le secteur du numérique - Alex Benay comment le Canada peut Gagner dans le secteur du numérique - Alex Benay
comment le Canada peut Gagner dans le secteur du numérique - Alex Benay
 
Rendre son équipe performante : plus simple qu'on le pense - Louis-Philippe C...
Rendre son équipe performante : plus simple qu'on le pense - Louis-Philippe C...Rendre son équipe performante : plus simple qu'on le pense - Louis-Philippe C...
Rendre son équipe performante : plus simple qu'on le pense - Louis-Philippe C...
 
Turning Research Ripples Into Waves: Growing UX Research Capacity Through Col...
Turning Research Ripples Into Waves: Growing UX Research Capacity Through Col...Turning Research Ripples Into Waves: Growing UX Research Capacity Through Col...
Turning Research Ripples Into Waves: Growing UX Research Capacity Through Col...
 
Complexité et systèmes opérables - Fred Hébert
Complexité et systèmes opérables - Fred HébertComplexité et systèmes opérables - Fred Hébert
Complexité et systèmes opérables - Fred Hébert
 
Designing brands that last - Ben Hulse
Designing brands that last - Ben Hulse Designing brands that last - Ben Hulse
Designing brands that last - Ben Hulse
 

Recently uploaded

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Recently uploaded (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

Frédérick Capovilla

  • 2. Architecture initiale HTML + JS Serveur web Navigateur
  • 3. Application Javascript HTML JSON HTML + JS Framework Javascript
  • 4. Une autre approche? HTML + JS Websocket
  • 6. Code d’une LiveView defmodule MyAppWeb.HelloWorldLive do use Phoenix.LiveView def mount(_session, socket) do {:ok, assign(socket, message: "Hello WAQ!!!")} end def render(assigns) do ~L""" <div>Message: <%= @message %></div> """ end end
  • 7. Code d’une LiveView defmodule MyAppWeb.HelloWorldLive do use Phoenix.LiveView def mount(_session, socket) do {:ok, assign(socket, message: "Hello WAQ!!!")} end def render(assigns) do ~L""" <div>Message: <%= @message %></div> """ end end
  • 8. Code d’une LiveView defmodule MyAppWeb.HelloWorldLive do use Phoenix.LiveView def mount(_session, socket) do {:ok, assign(socket, message: "Hello WAQ!!!")} end def render(assigns) do ~L""" <div>Message: <%= @message %></div> """ end end
  • 9. Utiliser une LiveView # Template <%= Phoenix.LiveView.live_render(@conn, DemoWeb.HelloWorldLive ) %> # Routeur live "/hello", DemoWeb.HelloWorldLive # Controlleur Phoenix.LiveView.Controller.live_render(conn, DemoWeb.HelloWorldLive )
  • 10. Ajouter de l’interactivité def render(assigns) do ~L""" <div>Message: <%= @message %></div> <button phx-click="add_message"> Ajouter WAQ!!! </button> """ end def handle_event("add_message", _value, socket) do message = socket.assigns.message <> "WAQ!!!" {:noreply, assign(socket, message: message)} end
  • 11. Ajouter de l’interactivité def render(assigns) do ~L""" <div>Message: <%= @message %></div> <button phx-click="add_message"> Ajouter WAQ!!! </button> """ end def handle_event("add_message", _value, socket) do message = socket.assigns.message <> "WAQ!!!" {:noreply, assign(socket, message: message)} end
  • 12. Fonctionnement GET /home HTML + JS liveSocket.connect() Socket connecté phx-click Fragments HTML
  • 13. Réponse serveur ["1", "4", "lv:phx-FHOaenCt", "phx_reply", { "response": { "diff": { "0": "Hello WAQ!!!WAQ!!!WAQ!!!" } }, "status": "ok" }]
  • 14. Partager des informations entre les utilisateurs def mount(_session, socket) do Phoenix.PubSub.subscribe(MyApp.PubSub, "topic") {:ok, assign(socket, message: "Hello WAQ!!!" )} end def handle_info(%{message: message}, socket) do {:noreply, assign(socket, message: message)} end def handle_event("add_message", _value, socket) do message = socket.assigns.message <> "WAQ!!!" Phoenix.PubSub.broadcast(MyApp.PubSub, "topic", %{message: message}) {:noreply, socket} end
  • 15. Partager des informations entre les utilisateurs def mount(_session, socket) do Phoenix.PubSub.subscribe(MyApp.PubSub, "topic") {:ok, assign(socket, message: "Hello WAQ!!!")} end def handle_info(%{message: message}, socket) do {:noreply, assign(socket, message: message)} end def handle_event("add_message", _value, socket) do message = socket.assigns.message <> "WAQ!!!" Phoenix.PubSub.broadcast(MyApp.PubSub, "topic", %{message: message}) {:noreply, socket} end
  • 16. Partager des informations entre les utilisateurs def mount(_session, socket) do Phoenix.PubSub.subscribe(MyApp.PubSub, "topic") {:ok, assign(socket, message: "Hello WAQ!!!")} end def handle_info(%{message: message}, socket) do {:noreply, assign(socket, message: message)} end def handle_event("add_message", _value, socket) do message = socket.assigns.message <> "WAQ!!!" Phoenix.PubSub.broadcast(MyApp.PubSub, "topic", %{message: message}) {:noreply, socket} end
  • 20. Cas d’utilisation Formulaires dynamiques Tableaux de bord Outils collaboratifs Jeux multijoueur