SlideShare a Scribd company logo
Real-time updates with
Mercure protocol and
Symfony UX Turbo
Jan Mikeš
#PHPAMSTERDAM
21.04.2022
@honza_mikes
▸Introducing the Mercure protocol & how it works
▸Suitable use cases
▸Clean implementation in Peon.dev codebase
What to expect from the talk
▸Hello world
▸How to install Mercure into your app
▸How to running Mercure server
▸Introduction to Hotwire Turbo
What to NOT expect from the talk
▸Fully open sourced (github.com/dunglas/mercure)
▸Native browser support using server-sent events
▸Leverages HTTP/2
▸Built-in connection re-establishment
▸Works in IE7+ with polyfills
▸JWT based authorization
▸Lovely Debug GUI
▸Pushing updates via HTTP POST 🔥
Mercure
The modern websockets
Real-time content updates with Mercure protocol and Symfony UX Turbo
Real-time content updates with Mercure protocol and Symfony UX Turbo
Real-time content updates with Mercure protocol and Symfony UX Turbo
cation benefits from
▸Live availability (e-commerce, booking.com)
▸Chat
▸Asynchronous jobs
▸Real-time user collaboration
User Experience - provide feedback to the user
▸User tells Peon to run a task, which creates a (pending) job
▸Worker in background starts working on this job
▸Job is finished
Peon "run a task" domain usecase
Real-time content updates with Mercure protocol and Symfony UX Turbo
Real-time content updates with Mercure protocol and Symfony UX Turbo
Real-time content updates with Mercure protocol and Symfony UX Turbo
Real-time content updates with Mercure protocol and Symfony UX Turbo
r user experience e
Real-time content updates with Mercure protocol and Symfony UX Turbo
▸User tells Peon to run a task, which creates a (pending) job
▸Worker in background picks this job
▸Job finishes
Peon "run a task" domain usecase
▸As a user, I want to see updates about the status
Before you start
▸Basic knowledge about the Mercure
▸Basic knowledge about the Hotwire Turbo
▸Running Mercure server to connect
▸Installed and configured symfony/ux-turbo-mercure
Real-time content updates with Mercure protocol and Symfony UX Turbo
Real-time content updates with Mercure protocol and Symfony UX Turbo
Application must behave exactly the
same way with Mercure as without it
Refreshing the page, user must see
exactly the same content
▸Reusable fragment template
▸Stream template, includes fragments
▸Controller template, includes fragments
3 types of templates
Real-time content updates with Mercure protocol and Symfony UX Turbo
https://symfony.com/bundles/ux-turbo/current/index.html#coming-alive-with-turbo-streams
Real-time content updates with Mercure protocol and Symfony UX Turbo
https://turbo.hotwired.dev/handbook/streams
▸Positive side effect on performance
▸If possible, use the Caddy as web server
▸Don't use it everywhere only because it is cool :-)
Final thoughts
Kudos to
Kévin Dunglas
▸https://mercure.rocks
▸https://turbo.hotwired.dev
▸https://symfony.com/bundles/ux-turbo
▸https://developer.mozilla.org/en-US/docs/Web/API/Server-
sent_events/Using_server-sent_events
▸https://developer.mozilla.org/en-
US/docs/Web/API/EventSource
▸https://github.com/peon-dev/peon
Useful resources
THANK YOU!
janmikes.cz
@honza_mikes

More Related Content

PDF
Import golang; struct microservice
PPTX
Microservices in the front end
PPTX
PPTX
Automate Workflows With The Open-source Cloud-native Tool Boomerang Flow
PDF
Continuous Delivery for Python Developers – PyCon Otto
PDF
IPC16: A Practical Introduction to Kubernetes
PDF
Red Hat Forum Benelux 2015
PDF
Adventures in docker compose
Import golang; struct microservice
Microservices in the front end
Automate Workflows With The Open-source Cloud-native Tool Boomerang Flow
Continuous Delivery for Python Developers – PyCon Otto
IPC16: A Practical Introduction to Kubernetes
Red Hat Forum Benelux 2015
Adventures in docker compose

Similar to Real-time content updates with Mercure protocol and Symfony UX Turbo (20)

PDF
Dockerization (Replacement of VMs)
PDF
Introduction to PaaS and Heroku
PPTX
Open stack icehouse microsoftupdate
PDF
Introduction to Docker and Linux Containers @ Cloud Computing Rhein Main
PDF
Stateful, Stateless and Serverless - Running Apache Kafka® on Kubernetes
PDF
Hybrid and Multi-Cloud Strategies for Kubernetes with GitOps
PDF
Hybrid and Multi-Cloud Strategies for Kubernetes with GitOps
PDF
From Development to Testing to Deployment with Puppet Enterprise and Microsof...
PDF
"13 ways to run web applications on the Internet" Andrii Shumada
PDF
2012 a deployment pipeline for infrastructure a dev ops case study at nbn _ ...
PDF
Cloud Native CI/CD with GitOps
PDF
PuppetConf 2016: Using Puppet with Kubernetes and OpenShift – Diane Mueller, ...
PPTX
Inithub.org presentation
PDF
Developer Experience Cloud Native - Become Efficient and Achieve Parity
ODP
PPTX
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...
PDF
Pivotal Cloud Foundry 2.3: A First Look
PDF
Building and Deploying PHP Applications, PHPTour 2016
PDF
Import golang; struct microservice - Codemotion Rome 2015
PDF
A0950107
Dockerization (Replacement of VMs)
Introduction to PaaS and Heroku
Open stack icehouse microsoftupdate
Introduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Stateful, Stateless and Serverless - Running Apache Kafka® on Kubernetes
Hybrid and Multi-Cloud Strategies for Kubernetes with GitOps
Hybrid and Multi-Cloud Strategies for Kubernetes with GitOps
From Development to Testing to Deployment with Puppet Enterprise and Microsof...
"13 ways to run web applications on the Internet" Andrii Shumada
2012 a deployment pipeline for infrastructure a dev ops case study at nbn _ ...
Cloud Native CI/CD with GitOps
PuppetConf 2016: Using Puppet with Kubernetes and OpenShift – Diane Mueller, ...
Inithub.org presentation
Developer Experience Cloud Native - Become Efficient and Achieve Parity
Overseeing Ship's Surveys and Surveyors Globally Using IoT and Docker by Jay ...
Pivotal Cloud Foundry 2.3: A First Look
Building and Deploying PHP Applications, PHPTour 2016
Import golang; struct microservice - Codemotion Rome 2015
A0950107
Ad

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Machine learning based COVID-19 study performance prediction
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
NewMind AI Weekly Chronicles - August'25 Week I
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Spectral efficient network and resource selection model in 5G networks
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Understanding_Digital_Forensics_Presentation.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Encapsulation theory and applications.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Electronic commerce courselecture one. Pdf
Unlocking AI with Model Context Protocol (MCP)
MYSQL Presentation for SQL database connectivity
Machine learning based COVID-19 study performance prediction
Encapsulation_ Review paper, used for researhc scholars
Diabetes mellitus diagnosis method based random forest with bat algorithm
Agricultural_Statistics_at_a_Glance_2022_0.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
The Rise and Fall of 3GPP – Time for a Sabbatical?
Ad

Real-time content updates with Mercure protocol and Symfony UX Turbo