I'm always excited to take on new projects and collaborate with innovative minds.

Phone

+977 9846930428

Email

mr.kashyapsandesh@gmail.com

Website

https://sandeshghimire.info.np

Address

Butwal,Nepal

Social Links

How I Fixed the SSL Connection Timeout in Laravel Reverb

Date: December 5, 2025
Issue: SSL Connection Timeout (cURL error 28)
Status: ✅ Resolved

Recently, while working on a Laravel application, I encountered a persistent issue: broadcasting LocationUpdated events through Laravel Reverb kept failing with SSL timeout errors. Here’s a deep dive into the problem and how I solved it.

How I Fixed the SSL Connection Timeout in Laravel Reverb

 

Date: December 5, 2025
Issue: SSL Connection Timeout (cURL error 28)
Status: ✅ Resolved

Recently, while working on a Laravel application, I encountered a persistent issue: broadcasting LocationUpdated events through Laravel Reverb kept failing with SSL timeout errors. Here’s a deep dive into the problem and how I solved it.

 

 


The Problem

The error in the logs looked like this:

Pusher error: cURL error 28: SSL connection timeout 
for https://example-api.com:8080/apps/966067/events

Symptoms:

  • Events were being queued but failing during broadcast.
  • Queue workers repeatedly logged SSL timeout errors.
  • Failures occurred in PusherBroadcaster.php, since Laravel Reverb uses the Pusher SDK internally.

Root Cause Analysis

The main problem was misconfigured Reverb settings.

  • The .env file pointed REVERB_HOST to an external domain: example-api.com.
  • Port 8080 is typically used for HTTP, not HTTPS.
  • Queue workers tried to establish SSL connections, which failed because local Reverb servers don’t have SSL configured.

Why it happened: Laravel Reverb uses the Pusher HTTP API internally. When configured to use HTTPS on port 8080 with an external host, it naturally resulted in connection timeouts.


The Fix

1. Update .env Configuration

Changed the host to local:

# Before
REVERB_HOST="example-api.com"

# After
REVERB_HOST=127.0.0.1

Why 127.0.0.1?

  • Avoids DNS lookup overhead
  • Works reliably in containerized environments
  • Faster local connections

2. Update Broadcasting Configuration

In config/broadcasting.php, add client_options:

'reverb' => [
    'driver' => 'reverb',
    'key' => env('REVERB_APP_KEY'),
    'secret' => env('REVERB_APP_SECRET'),
    'app_id' => env('REVERB_APP_ID'),
    'options' => [
        'host' => env('REVERB_HOST', '127.0.0.1'),
        'port' => env('REVERB_PORT', 8080),
        'scheme' => env('REVERB_SCHEME', 'http'),
        'useTLS' => env('REVERB_SCHEME', 'http') === 'https',
    ],
    'client_options' => [
        'verify' => false,        // Disable SSL verification locally
        'timeout' => 5,           // 5-second timeout
        'connect_timeout' => 5,   // 5-second connection timeout
    ],
],

3. Clear Configuration Cache

php artisan config:clear
php artisan cache:clear
php artisan config:cache
php artisan optimize:clear

Queue workers rely on cached configuration, so clearing cache is essential.


4. Restart Queue Workers

php artisan queue:restart
sudo supervisorctl restart reverb-queue:*

5. Restart Reverb Server

sudo supervisorctl restart reverb:*
# Or
php artisan reverb:restart

Verification

  1. Check broadcasting config:
php artisan config:show broadcasting.connections.reverb.options

Expected output:

host    127.0.0.1
port    8080
scheme  http
useTLS  false
  1. Test Reverb server connectivity:
curl -s -o /dev/null -w "%{http_code}" --connect-timeout 2 http://127.0.0.1:8080/apps/966067/events

Expected result: 405 (server running).

  1. Check queue worker status:
sudo supervisorctl status reverb:*
sudo supervisorctl status reverb-queue:*
  1. Monitor logs:
tail -100 storage/logs/laravel.log | grep -E "ERROR.*SSL|ERROR.*timeout"
tail -20 storage/logs/laravel.log | grep "Broadcasting LocationUpdated"

Key Takeaways

  • Use localhost/127.0.0.1 for local development.
  • Configure HTTP for local Reverb connections; HTTPS only for production.
  • Always clear config cache after changing .env.
  • Restart queue workers to apply new config.
  • Use client_options to manage SSL and timeout settings for local development.

 

Laravel Reverb
3 min read
Dec 05, 2025
By Sandesh Ghimire
Share

Leave a comment

Your email address will not be published. Required fields are marked *

Your experience on this site will be improved by allowing cookies. Cookie Policy