Mercure

Real-time made easy — a protocol for pushing updates to browsers.

Language: GoCategory: Real-timeFirst released: 2018Created by: Kévin DunglasLicense: AGPL-3.0

Mercure is an open protocol and server implementation for real-time, low-latency server-to-client communication built on top of Server-Sent Events (SSE). Unlike WebSocket-based solutions, Mercure uses standard HTTP, making it compatible with existing HTTP infrastructure including load balancers, CDNs, and caching layers. Clients subscribe to topics via URL query parameters and receive pushed updates as JSON-LD events. The protocol leverages JWT for authorization, allowing servers to specify which topics a client may subscribe to directly in the token payload. Mercure handles automatic reconnection with Last-Event-ID headers for event replay, supports CORS for cross-origin access, and includes a polyfill for browsers that lack native EventSource support. It is a core component of the API Platform framework and is used to build reactive user interfaces with Symfony, Laravel, and other PHP stacks.

Links

Key Features

Server-Sent Events (SSE)JWT authorizationAutomatic reconnectionTopic-based subscriptionsCORS supportPublish-subscribe modelPolyfill fallback