Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

veptune's avatar

Livewire component not received the event sent by Livewire.dispatchTo

Hello all,

I tried to dispatch an event to a livewire component, but the event was not received.

In my app.js I have :

window.Echo.channel('channel-place')
    .listen('.PlaceAddedEvent', (e) => {
        console.log('PlaceAddedEvent received:', e); // Vérifiez si ce message apparaît dans la console du navigateur
    
        if (typeof window.Livewire !== 'undefined') {
                console.log("dispatchto");
                Livewire.dispatchTo('places-table', 'PlaceAddedEvent', { message: 'Test' });
                console.log('Dispatch finished');
        } else {
            console.error('Livewire is not available.');
        }
});

And it seems to work, I don't have any errors. 

Here is my Livewire PHP component : 

In my blade file :

@livewire('places-table', ['searchId' => $search->id])

As you can see, the component name places-table match with the dispatchTo method, as well as the event name.

When I try to dispatch the event from the same blade that included the livewire, it doesn't work :

<button wire:click="$dispatch('PlaceAddedEvent', { message: 'Test Button' })">
    Test Event Dispatch
</button>

But when I displatch it from the PHP component itself, it works :   

$this->dispatch('PlaceAddedEvent', ['message' => 'Test direct interne']);

Any clue?

Thanks

0 likes
3 replies
Chingy's avatar

Does Livewire.dispatch work at all ?

veptune's avatar

How can i know? But I don't see any errors in the console.

veptune's avatar

OK it found it.

It was because the name of the variable "message" has to match with the argument of the method :

public function handlePlaceAdded($payload) { Log::info('PlaceAddedEvent RECEIVED :', $payload); $this->render(); }

I had to repalce "$payload" by "$message"

Please or to participate in this conversation.