In this episode, we're diving into setting up real-time client-to-client communication ("whispering") for our checkbox app in Laravel. We start by ditching the old button-based communication and get Laravel's broadcasting up and running using Laravel Reverb. You'll see how to install and configure everything needed for real-time updates on your local machine.
The biggest challenge is that whispering over WebSockets in Laravel normally requires authenticated users, but our app isn't using a real auth system. We'll work around this by "faking" user authentication: creating an in-memory user so all our clients can join the private checkboxes channel for whisper communication. You'll see step-by-step how to do this safely and just for local dev.
Once we're all set up, we wire up the front end to listen for checkbox changes. When a user toggles a checkbox, we immediately whisper that update to all other clients, so everyone sees changes happen in real time — without any page reloads! We'll also cover how to listen for these events on the other clients and update their state accordingly.
By the end, you'll have checkboxes that sync instantly between browsers (including incognito tabs 😉). However, you'll notice that our changes aren't persistent yet — if you refresh, the state is lost. In the next episode, we'll tackle storing this state on the backend. But now, you've got live, snappy cross-client updates working!