Repository navigation
Laravel Reverb not Broadcasting REST API with Docker #51864
Replies: 2 comments 2 replies
|
Echo prefixes the event name with "App.Events." so in examples you don't see For: App\Events\Orders\OrderCanceled it will become => The rest of your setup based on what you said seems fine, if this is not the problem a public repo that you can share with us that reproduces this bug will be helpful. |
|
Fixed! There were a few issues in the end. Backend REST api:
This wasn't clear and the default options in the comments
Code: Front end
Code: |
Uh oh!
There was an error while loading. Please reload this page.
My Laravel 11 application is not broadcasting anything using Laravel Reverb. I am using a custom Docker configuration to spin up my enviornment and Laravel acts as a REST api interacting with a React stand-alone front-end.
My
reverb.phpfile in myconfig/directory is untouched as I just updated the.env.The
broadcasting.phpfile has this set as the driver as from what I gather Laravel Reverb runs it's own configreverb.php.When running
php artisan queue:listenwithin my Docker container I can see the Events firing and everything running as it should...When running within my Docker container
php artisan reverb:start --debugI can see some ping logs.With the front-end in the Network tab again everything looks ok, it pings the
/broadcasting/authand my setupws://localhost:9090/app/The connection itself seems ok? One thing to note is if I hit the endpoint to fire the event, I see no logs for the broacast
php artisan reverb:start --debugMy Event, which is really basic for now and gets caught and logs when runnig
queue:listenbut never broadcasts, although the thebroadcastOn()method gets hit and I can catch with add()Even if I make a channel not private I still get nothing!
in my
channels.phpthedd()inside thechannel_for_everyonenever hits, but the file is 100% getting loaded as when I dd() above it willdd('it will hit here!);My React code is super basic, I made a hook to execute and it logs a successful connection, just no events are every logged.
When I check the console in browser:
I know this must be some kind of configuration error but I just cannot seem to find the issue as I have no errors or logs to go off!
Has anyone got any idea?
All reactions