This demo showcases the use of Mercure (a modern substitute for WebSockets) to send real-time public and private messages in a Laravel Livewire application—no page refresh or polling required.
git clone https://github.com/benbjurstrom/livewire-mercure-demo.git
cd livewire-mercure-demo
composer install
npm install && npm run build
./vendor/bin/sail up
./vendor/bin/sail artisan migrate:fresh --seed
http://localhost/login
. Login with user1@example.com
and password
.sail artisan message:send
to send a message.This repo was created from a fresh Laravel 10 install with the Laravel Breeze package added. From there everything needed to get Mercure up and running can be found in this diff: https://github.com/benbjurstrom/livewire-mercure-demo/commit/220ec5118c107f3c1cef7ddbf73d058e4744d0de