Magento 2 Experten — Hyvä Theme, Tailwind CSS & SEO aus einer Hand ›

Block 8 Summary: Mercure & Real-Time Updates

Block 8 Summary: Mercure & Real-Time Updates

~14 Min. Lesezeit Zuletzt aktualisiert am August 8, 2026

Block 8 is COMPLETE. The API can NOW not only RESPOND on request, but ACTIVELY INFORM about changes – the BACKEND foundation for a frontend that stays CURRENT WITHOUT polling.

What block 8 covered

  • Chapter 67: Mercure basics, the hub in the Docker Compose setup, topics.
  • Chapter 68: mercure: true, automatic publication on default operations.
  • Chapter 69: subscriptions via EventSource and via curl -N.
  • Chapter 70: JWT authorization for private topics, the mercureAuthorization cookie.
  • Chapter 71: custom publications in custom operations via HubInterface.

Project state at the end of block 8

state after chapter 71

api/
├── .env                              ← MERCURE_URL, MERCURE_JWT_SECRET
└── src/
    ├── Entity/Project.php             ← mercure: true
    ├── Security/MercureTokenGenerator.php
    └── State/ArchiveProjectProcessor.php  ← HubInterface publication

Apply it yourself: enabling Mercure on Task

As an EXERCISE: enable mercure: true on Task and TEST that a PATCH request on a task (e.g. setting done: true) does NOT automatically appear in a subscription to the RELATED project's topic – Task and Project are SEPARATE topics, EXACTLY like SEPARATE API resources (chapter 39).

What's coming in block 9

With block 8, the ENTIRE backend functionality (aufgaben-manager-api) is COMPLETE – block 9 (chapters 73-82) shifts ENTIRELY to the React frontend (aufgaben-manager-web, only RUDIMENTARILY connected since chapter 7): TanStack Query for data fetching, axios interceptors for JWT, ONE cohesive auth concept, and the FIRST REAL connection between the API features built in chapters 9-71 and an actual user interface.

Tipp: Before block 9, it's worth a look back at chapters 7-8 (React project setup, CORS) – block 9 builds DIRECTLY on that, but GOES WELL beyond the simple connectivity test from back then.