
Real-time messaging with Mercure SSE in PHP
Ahnii! Mercure lets you push real-time updates to browsers using server-sent events (SSE), without WebSocket complexity. This post covers how Minoo , a community platform built on the Waaseyaa framework, uses Mercure for real-time messaging with threads, user blocking, and email notification digests. How the messaging layers fit together The messaging system has four layers: Entities — Thread, Participant, and Message stored in SQLite Controller — handles HTTP requests for sending messages and listing threads MercurePublisher — pushes new messages to subscribed browsers via SSE MessageDigestCommand — CLI command that emails unread message summaries on a cron schedule When a user sends a message, the controller saves it to the database, then publishes an event through Mercure. Every browser with that thread open receives the message instantly. Users who are offline get an email digest every four hours. The MercurePublisher The publisher lives in the waaseyaa/mercure framework package. I
Continue reading on Dev.to
Opens in a new tab



