In this episode, we dive into broadcasting events on private channels. We'll start by creating a new event that specifically targets a private channel instead of a public one. You'll see how to define the private channel on the server, set up a basic authorization rule (for now, we're just allowing any authenticated user), and then hook it up to the client side for listening.
Once that's in place, we swap out our API to broadcast using this new private event. On the front-end, we switch from listening for public events to private ones by using the respective Echo method.
However, things don't work just yet! We'll walk through what goes wrong and why it's happening. Specifically, you'll notice an auth request is sent out to try and authorize the user's connection to the private channel. The key issue: it's hitting the wrong domain, so even though we get a 200 OK response, we aren't actually authenticated and don't receive any events.
By the end of this video, you'll have a solid understanding of the authentication flow for private channels, what goes on behind the scenes, and why we need to tweak our setup to properly handle the authentication requests, which is exactly what we'll tackle in the next episode.