Jeudi - 14h45 - 15h25 2:45 pm - 3:25 pm




Tech & Governance

Mercure: UIs always synchronized with data in database

Conference in French

What if your web sites and mobile apps could update themselves? What if changes to the data in your system could immediately show up as changes on your platform? Automatic, real-time updates to prices, product availability, comments… Mercure technology allows servers to send live updates about nearly anything to all kinds of clients. The protocol in question is based on a series of “Server-Sent Events”, which means that it’s supported by browsers natively (without any need for SDKs or external libraries). And, it works particularly well with HTTP/2 (as opposed to Websocket, which is incompatible with this new protocol) as it bypasses all firewalls. Mercure is versatile: it’s auto-discoverable through web-linking; it has been designed to be used with hypermedia API and GraphQL; it possesses an authentication mechanism that can allow for certain updates to reach certain clients; it can re-connect users automatically should they lose connection; and it can even re-send messages that would otherwise have been lost. What’s more, Mercure can work with languages and architectures that don’t support persistent connections, such as the serverless framework (e.g. Amazon Lambda, Google Cloud Functions…) or PHP. Mercure is even officially supported by Symfony and API Platform. In this presentation, I’ll talk about this protocol in depth, and we’ll discover how you can: * install a Mercure server via Docker * use Web Linking to see a client-side view of the server * take advantage of EventSource to subscribe to app updates * publish updates via pure PHP, Symfony and API Platform (which officially support Mercure) * update React/React Native apps with data sent via Mercure