Symfony

Real-time & WebSockets

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

18 câu hỏi phỏng vấn·
Senior
1

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

Câu trả lời

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)?

Câu trả lời

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?

Câu trả lời

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 câu hỏi phỏng vấn

Nắm vững Symfony cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí