🚀 Available for Freelance, Remote, and Full-Time Opportunities. Let's build something amazing together.

News
1 min read

Mercure Broadcasting in Laravel 13.32

Laravel 13.32 adds first-class support for the Mercure broadcasting protocol, delivering real-time Server-Sent Events (SSE) without dedicated WebSocket clusters.

A

Author

2 weeks ago

Native Mercure Protocol Support in Laravel 13.32

The release of Laravel 13.32 introduces built-in driver support for the Mercure broadcasting protocol. Mercure enables real-time data streaming to browsers, mobile apps, and edge microservices using standard HTTP Server-Sent Events (SSE).

Why Mercure?

Unlike traditional WebSockets which require persistent bidirectional TCP connections, stateful proxy servers, and specialized client libraries, Mercure operates entirely over HTTP/2 and HTTP/3:

  • No Node.js or Redis Socket Servers: Mercure runs effortlessly through FrankenPHP, Caddy, or standalone Docker instances.
  • Native Browser Support: Frontend applications can subscribe to event streams using standard browser EventSource APIs without large vendor bundles.
  • Battery & Firewall Friendly: SSE connections automatically reconnect, bypass enterprise proxy filters, and consume minimal mobile battery.

Configuring Mercure in Laravel

// config/broadcasting.php
'mercure' => [
    'driver' => 'mercure',
    'url'    => env('MERCURE_URL', 'http://127.0.0.1:2019/.well-known/mercure'),
    'secret' => env('MERCURE_JWT_SECRET'),
],

// Dispatching events as usual
event(new OrderStatusUpdated($order));