Laravel Echo with Reverb Not Listening to Events in Real-Time and Showing Pusher Errors
Hello everyone,
I'm facing an issue with Laravel Echo where I'm using Reverb for broadcasting events instead of Pusher. However, when I try to listen to events in real-time, nothing happens until I reload the page. Additionally, I keep encountering errors related to Pusher even though I'm not using Pusher at all.
@martinbean
Error : [2024-08-20 16:19:57] local.ERROR: Pusher error: cURL error 7: Failed to connect to localhost port 8080...
Steps I've Taken:
Ensured that BROADCAST_DRIVER is set to reverb in .env.
Cleared configuration and cache using php artisan config:clear and php artisan cache:clear.
Verified that there are no references to Pusher in my configuration files or event classes.
Tried running php artisan queue:work to see if that resolves the issue.
Problem:
The event doesn’t listen in real-time until I reload the page.
The error message still shows references to Pusher even though I’ve configured Laravel to use Reverb.
My Questions:
Why is Laravel still attempting to use Pusher despite my configuration for Reverb?
How can I ensure that events are listened to in real-time with Reverb, and get rid of these Pusher-related errors?
Any help or guidance would be greatly appreciated! Thank you!
Unless you write down all the "steps to reproduce", others won't be able to understand.
Launch php artisan reverb:start --debug and php artisan serve together in separate terminal tabs. If the settings are correct, it will run without errors.
The Reverb driver is the same as the Pusher driver. Reverb provides a Pusher-compatible WebSocket server.
protected function createReverbDriver(array $config)
{
return $this->createPusherDriver($config);
}
I followed your instructions and launched php artisan reverb:start --debug and php artisan serve in separate terminal tabs. The WebSocket connection was successfully established without any errors.
However, the issue persists—events are not being received in real-time. They are only received after I reload the web page. The Reverb server seems to be functioning correctly, but the events are not triggering the front-end listener until the page is refreshed.
Is there anything else I might be missing or any further steps I should take to ensure real-time event broadcasting with Reverb?
@novasugiantara I am facing the same issue, but with Laravel-websocket and pusher along with laravel-echo.
I am using Laravel notifications along with event broadcaster to broadcast the notifications to the public channel. I am receiving the notifications in web-socket through pusher but listener does not catch the event unless i refresh the page.
Are you using Laravel 11? If so, remember that the config parameter in .env changed from BROADCAST_DRIVER to BROADCAST_CONNECTION. Maybe you have the old parameter defaulting to pusher somewhere.