I've moved my Laravel Events into subdirectories, and now my broadcasted messages are not being received. Pusher shows them ok, and if I move them out of the subdirectories then they work as expected, so I believe this is a namespacing issue, but I cannot figure out how to make it work.
The Event I'm focusing on is called TeamInvitationEvent
and is located in the Events->Company->Memberships
directory.
Here is my Listener:
public function getListeners()
{
$user_id = Auth::id();
return [
'refresh-navigation-top-menu' => '$refresh',
"echo-private:user.{$user_id},TeamInvitationEvent" => 'notifyInvitation',
"echo-private:user.{$user_id},TeamInvitationCancelledEvent" => 'notifyInvitationCancelled',
"echo-private:user.{$user_id},TeamInvitationAcceptedEvent" => 'notifyInvitationAccepted',
"echo-private:user.{$user_id},TeamMemberRemovedEvent" => 'notifyMemberRemoved',
];
}
Here is a screenshot of my Pusher debug console, showing that the user is subscribed to the correct private channel, and that the API Message is being broadcast on that channel:
Here is a list of different ways I've tried to correct for the new namespace:
- App.Events.Company.Memberships.TeamInvitationEvent
- App\Events\Company\Memberships\TeamInvitationEvent
- /App/Events/Company/Memberships/TeamInvitationEvent
- .TeamInvitationEvent
There are no errors in the Laravel logs, or in the Pusher logs, and as I mentioned it works as expected if I don't move them into the subdirectory.
I'm running the following in my app:
- Laravel v8
- Livewire v2
- Laravel Echo v1
- Pusher