What is Broadcasting in Laravel?
Why Interviewers Ask This
Candidates at the intermediate level are expected to not only know this concept but explain the trade-offs involved. Interviewers use this question to see if you can reason about design decisions, not just recall facts.
Answer
Broadcasting allows server-side events to be sent to the browser in real-time via WebSockets. Laravel supports Pusher, Ably, Laravel WebSockets (self-hosted), and Soketi. Make an event broadcastable by implementing ShouldBroadcast and define the channel in broadcastOn(): return new Channel("orders.{$this->order->id}"). On the frontend, subscribe with Laravel Echo: Echo.channel("orders.1").listen("OrderShipmentStatusUpdated", (e) => { ... }). Private channels require authentication (defined in routes/channels.php): Broadcast::channel("orders.{orderId}", fn($user, $orderId) => $user->id === Order::find($orderId)->user_id). Broadcasting enables live notifications, chat features, real-time dashboards, and collaborative editing.
Pro Tip
Demonstrate both theoretical understanding and practical experience. Say what it is, then give an example of how you actually used it in a Laravel codebase.