Selected Session

Real-Time applications using the Mercure protocol

Rainer Friederich
Level of expertise
Session Type
Regular (45 min)
Time Slot

Drupal and PHP are usually a bad fit when it comes to real time applications with live updates.

The most solutions for this problem are closed source, paid only and not a good fit for php in general.

Probably some of you have heard about Pub/Sub, pusher,, web-sockets, GraphQL subscriptions, EventSource or  http fetch streams.

Most of these protocols and services offer a very niche use-case and depend on specific implementations and vendors.

There is however an open source solution based on web standards that can be used perfectly in PHP and Drupal projects with a very low overhead in the actual application and its consumers. Symfony and the Mercure protocol from the api platform project allow for a very performant and secure solution to real-time communication in API first applications.

This talk is about what ServerSentEvents and a EventSource is, how the Mercure protocol and the Mercure hub work and how it can be leveraged in a Symfony and Drupal application to deliver live updates to the client application with a very low amount of code an almost no side effects.