azay's avatar
Level 1

In my local machine broadcasting and it works fine but in Production which is Digital ocean app platform it cannot connect to the server.

In my local machine broadcasting and it works fine but in Production which is Digital ocean app platform it cannot connect to the server.

.env

BROADCAST_DRIVER=reverb

REVERB_APP_ID=my-app-id
REVERB_APP_KEY=my-app-key
REVERB_APP_SECRET=my-app-secret
REVERB_HOST=0.0.0.0        # Bind to all interfaces
REVERB_SCHEME=https         # Use https for security, especially since your app is hosted publicly
REVERB_PORT=6001            # same with 443 

broadcasting.php

reverb.php

in my controller i try to broadcast this

                       broadcast(new FileUploaded($user->id, $file->getClientOriginalName(), $counter, $asset->id));
                   } catch (\Exception $e) {
                       // Log detailed error information
                       Log::error('Error broadcasting FileUploaded event:', [
                           'message' => $e->getMessage(),
                           'file' => $e->getFile(),
                           'line' => $e->getLine(),
                           'trace' => $e->getTraceAsString(),
                       ]);
                   } 

i got following error:

Local. ERROR: Error broadcasting FileUploaded event: ("message": "Pusher error: CURL error 7: Failed to connect to 0.0.0.0 port 6001 after 6 ms: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://0.0.0.0/apps/my-app-id/events?auth_key=my-app-key&auth_timestamp=1727691940&auth_version=1.0&body_md5=bdfd3fdcc3c19ab647114c8d4ca230e2&auth_signature=cd729c19fa4d846b99f424b7a856584445272f695ffe9ff26cc786@fe0e39a71.", "file": "/workspace/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php", "line": 164, "trace": "#0 /workspace/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php(92): Illuminate\Broadcasting\Broadcasters\PusherBroadcaster->broadcast()")

Same thing happens with port 443 and port 8080 i got ssl error which is understandable. In console when i run start the server it is starting.

php artisan reverb:start --debug

   INFO  Starting server on 0.0.0.0:6001.  

  Pruning Stale Connections .......................................................................................  
  Pinging Inactive Connections 

From postman i tried wss connection but it is tied out. I am out of options now.

0 likes
2 replies
LukasCCB's avatar

I have the same problem.

The part about setting up SSL for Reverb in production is very confusing (for me) and the documentation doesn't teach this part in much detail.

After many months trying to find solutions, all I found out is that some types of Certificates give an error natively for Reverb to work. But other than that, I have the same problem getting Reverb to work in production on my CloudPanel and CloudFlare.

Locally everything is wonderful!

1 like
admin@sandwave.io's avatar

I have the exact same issue. Locally everything works fine and broadcasts are being picked up by Horizion.

On production I managed to get everything working, I can actually see the client connect to the web socket server and subscribe to the (private) channels with working authentication.

But when I dispatch a broadcast Horizon gives me the 'could not connect error' as well:

Pusher error: cURL error 7: Failed to connect to myproductionserver.com port 443 after 1 ms: Could not connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://myproductionserver.com/apps/200468/events?auth_key=redacted&auth_timestamp=1743885546&auth_version=1.0&body_md5=redacted&auth_signature=redacted.

Please or to participate in this conversation.