In this episode, we get hands-on with installing and configuring Soketi—a self-hosted WebSocket server that's a drop-in replacement for Pusher. We start off by installing Soketi globally using npm, making sure it's available anywhere on your machine. After running Soketi to start the server, I walk you through troubleshooting a common issue: Node version mismatches. If you hit an error, I show you how to downgrade Node using the handy 'n' helper.
Once Soketi is up (by default on port 6001), we briefly explore its endpoints and usage stats before moving on to the Laravel side of things. The lesson covers setting Laravel’s broadcasting settings to use the Pusher driver, but instead of sending real-time events to the Pusher service, we’ll direct them right to our local Soketi server. You’ll see how to install the Pusher PHP SDK, adjust your .env
and config/broadcasting.php
files, and set the correct host, port, and scheme for your setup.
Next, we build a super simple broadcast event in Laravel called NewThingAvailable
, make it public, and hook up a test route to dispatch it. We make sure to implement the ShouldBroadcast
interface—something that's easy to forget! After fixing a typo or two, we test it in the browser, fire off the event, and see it sent over to Soketi, ready for our JavaScript frontend to listen for in real time.
By the end of this lesson, you’ll have a fully working Soketi server, properly connected to your Laravel app and firing real-time events, setting the stage for hooking up the client side in the next steps.