Symfony

Real-time & WebSockets

Mercure, WebSockets, Server-Sent Events, push notifications, real-time updates

18 pertanyaan wawancara·
Senior
1

What is Symfony's recommended protocol for implementing real-time features?

Jawaban

Mercure is Symfony's officially recommended protocol for real-time features. Developed by Kévin Dunglas (creator of API Platform), Mercure is based on Server-Sent Events (SSE) and offers native Symfony integration via the symfony/mercure bundle. It enables efficient server-to-client unidirectional communication with automatic reconnection.

2

What is the main difference between WebSockets and Server-Sent Events (SSE)?

Jawaban

WebSockets establish a bidirectional full-duplex connection allowing both client and server to send messages at any time. SSE is unidirectional: only the server can send data to the client. SSE uses standard HTTP (easier to deploy behind proxies), while WebSockets use a distinct protocol after the initial handshake.

3

Which Symfony bundle enables Mercure integration in an application?

Jawaban

The symfony/mercure-bundle provides official Mercure integration with Symfony. It automatically configures the HubInterface service for publishing updates and generates subscription URLs. The bundle is installed via Composer and requires an external Mercure hub (Caddy with Mercure module or standalone Mercure binary).

4

How to publish a message to a Mercure topic from a Symfony controller?

5

What is the purpose of JWT in Mercure authentication for private topics?

+15 pertanyaan wawancara

Kuasai Symfony untuk wawancara berikutnya

Akses semua pertanyaan, flashcards, tes teknis, latihan code review dan simulator wawancara.

Mulai gratis