If you are using the broadcast as function then you need to add a period in front of the event name and it will work
EVENT:
public function broadcastAs()
{
return 'OrderShipped';
}
COMPONENT:
public function getListeners()
{
return [
"echo-private:orders.{$this->orderId},.OrderShipped" => 'notifyNewOrder',
];
}
public function notifyNewOrder()
{
$this->showNewOrderNotification = true;
}
If you are NOT using the broadcasts and using Laravel's default naming for events then WHAT YOU posted originally will work
COMPONENT:
public function getListeners()
{
return [
"echo-private:orders.{$this->orderId},OrderShipped" => 'notifyNewOrder',
];
}
public function notifyNewOrder()
{
$this->showNewOrderNotification = true;
}
The reason for this is that livewire automatically adds App\Events\ infront of the event name so although you type
"echo-private:orders.{$this->orderId},OrderShipped" => 'notifyNewOrder',
it is interpreted as
"echo-private:orders.{$this->orderId},App\Events\OrderShipped" => 'notifyNewOrder',
unless you put the . which circumvents it from prepending `App\Events