Building real-time application using the Mercure protocol

Workshop abstract

Mercure is a protocol allowing to push data updates to web browsers and other HTTP clients in a convenient, fast, reliable and battery-efficient way. It is especially useful to publish real-time updates of resources served through web APIs, to reactive web and mobile apps. It is provided with an open source implementation written in Go.

It provides:

  • native browser support, no lib nor SDK required (built on top of HTTP and server-sent events)
  • compatible with all existing servers, even those who don't support persistent connections (serverless architecture, PHP, FastCGI...)
  • built-in connection re-establishment and state reconciliation
  • JWT-based authorization mechanism (securely dispatch an update to some selected subscribers)
  • performant, leverages HTTP/2 multiplexing
  • designed with hypermedia in mind, also supports GraphQL
  • auto-discoverable through web linking
  • message encryption support
  • can work with old browsers (IE7+) using an EventSource polyfill
  • connection-less push in controlled environments (e.g. browsers on mobile handsets tied to specific carriers)

During this workshop, we'll learn the basics of Mercure, then how to use it with PHP, through the Symfony bundle, and with API Platform.


Resources

Kévin Dunglas

Creator of API Platform & Mercure.rocks, Symfony Core Team

Kévin is the founder or the self-managed company Les-Tilleuls.coop. Polyglot developer, he is a member of the Symfony Core Team and is the creator of the API Platform framework. He also has contributed to 100+ open source projects and frequently speaks at tech conferences.