Laravel echo + reverb problems #50625
-
So i have a clean Laravel installation - totally new project. Wanted to try out laravel websockets - reverb. Setup project with Jetstream - Livewire. Project is using Sail. The problem is nothing is happening from the backend side - no errors, exceptions, nothing. Event gets dispatched handled by the queue (either sync or database, tried both) but I can't see it on reverb server as it just disappeared. I also tried connecting with Laravel Echo from the frontend part but i only get console error: I would love to use Reverb and Echo but i just can't get it to work even in new clean project.... Any help would be appreciated. Here is .env:
Here is broadcasting.php:
And finally reverb.php:
|
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 13 replies
-
Okay, i found evenr more info with debugger. Apparently because my event has no "boradcastConnections" function it returns an empty array which in return makes it go to NullBroadcaster |
Beta Was this translation helpful? Give feedback.
-
hey, had similar issues yesterday... For me it worked changing the following line in .env "BROADCAST_DRIVER=pusher", as 'reverb' is not a supported driver (found this out via the laravel.log). Doing so my events have been succesfully shipped to my frontend, but I still have some problems with notifications/private channels... |
Beta Was this translation helpful? Give feedback.
-
I also found that
Lost 3-4 hours on that oversight. |
Beta Was this translation helpful? Give feedback.
-
How do you even get passed the POST http://localhost:8000/broadcasting/auth [HTTP/1.1 404 Not Found 543ms] I setup all the basics of Laravel Reverb according to the documentation. In my Vue front-end I have. onMounted(() => {
window.Echo.private(`App.Models.User.${user.id}`)
.listen('Example', (event) => {
console.log(event);
});
});
onUnmounted(() => {
window.Echo.leave(`App.Models.User.${user.id}`);
}); Example being a simple event I made using |
Beta Was this translation helpful? Give feedback.
-
Okay so basically for me - Laravel Sail was the problem. Basically i had to expose a seperate port - 8080 in my case (but depends on your config - care you might have phpmyadmin there). After rebuilding without cache it started working. A stupid oversight but still - it should be in the docs of either sail or reverb since those are in theory supposed to work together |
Beta Was this translation helpful? Give feedback.
-
omg docker-compose.ymd
php artisan reverb:start [i lost this step] |
Beta Was this translation helpful? Give feedback.
-
I got the same issue, and I solved using |
Beta Was this translation helpful? Give feedback.
-
REVERB_HOST="0.0.0.0" will be replaced by REVERB_HOST=localhost inside .env file |
Beta Was this translation helpful? Give feedback.
Okay so basically for me - Laravel Sail was the problem. Basically i had to expose a seperate port - 8080 in my case (but depends on your config - care you might have phpmyadmin there).
Full config:
laravel.test:
build:
context: ./docker/8.3
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.3/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
- '${REVERB_SERVER_PORT:-8080}:8080'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
IGNITION_LOCAL_SITES_PATH: '${PWD}'
volumes:
- '.:/var/www…