laravel / reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.
https://reverb.laravel.com
MIT License
942 stars 63 forks source link

I have issue in reverb broadcasting with Laravel Forge #184

Closed rahmani-djamel closed 2 months ago

rahmani-djamel commented 2 months ago

Reverb Version

@beta

Laravel Version

11.0

PHP Version

8.3

Description

I have a strange issue with reverb it works locally but it is not in production with no error log. I'm using Laravel Forge and this is my .env file

BROADCAST_DRIVER=reverb CACHE_DRIVER=file FILESYSTEM_DISK=local QUEUE_CONNECTION=sync

REVERB_HOST=ws.***.co REVERB_PORT=443 REVERB_SCHEME="https" REVERB_SERVER_PORT=8080

websocket issue

but when I broadcast event locally it show on my browser console but in live it didn't I check laravel telescope and I found the event so the issue in the the connection between echo and reverb

how to fix that ?

Steps To Reproduce

reverb_issue

rahmani-djamel commented 2 months ago

more reverb more1 more2

window.Echo.channel('upload.') .listen('.upload-completed', (event) => { console.log(event); console.log("success"); });

I tested the connection in Postman and it worked

{
    "event": "pusher:connection_established",
    "data": "{\"socket_id\":\"456890587.966221455\",\"activity_timeout\":30}"
}

which kind of information I can provide more

joedixon commented 2 months ago

Hey @rahmani-djamel do you see any errors in you application logs or failed jobs table?

rahmani-djamel commented 2 months ago

hi @joedixon no errors in the console or the log file no failed job records I create a route to fire the event


Route::get('/test-event', function () { 
    event(new \App\Events\UploadCompleted(1));
    return 'Event has been sent!';
});

and locally no errors and it works fine but In production 0 errors and not work

should I provide more information? please specify the information you want.
joedixon commented 2 months ago

On Laravel 11, I believe the broadcast environment variable should be BROADCAST_CONNECTION= rather than BROADCAST_DRIVER= as you have listed in your original post.

rahmani-djamel commented 2 months ago

yes that was exactly the issue thank you @joedixon