Hi everyone,
I'm having a similar issue here - the callback is not executing.
Previously, I tried using the useEcho hook from @laravel/echo-vue, and I came across an issue on the official GitHub page related to useEchoPublic. In short, you need to call .listen() for it to work properly. For example:
useEchoPublic('test-channel', '.TestChannelData', (e) => {
console.log(e.data);
}).listen();
I applied the same .listen() call to useEcho, and it worked.
Now I'm experimenting with React + Inertia, and I can't get the callback to work - no matter what I try. It doesn't work with or without .listen().
I even tried something like this ( I know what it's not necessary but anyway):
const { listen } = useEcho(
'testChannel',
'testEvent',
myCallback,
);
listen();
…but that didn't help either.
The useEcho is kind of working. Judging by Chrome dev tools, it's connecting and receiving messages successfully, but the callback never gets executed.
So if anyone has any insight into this issue, please let us know. Thanks in advance!