Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bhosted's avatar

Mac / Homestead / Reverb over wss not working

Hi,

I got Homestead up and running on my new Mac. Project is running and Reverb was running just fine over ws. The website is secured and the ca.homestead is added to my Mac.

Next step is enabling wss: added the private and public keys, changed the scheme to https, but no such luck. The client browser reports that the connection to ws.example.com is not possible. On FireFox and on Chrome. Connection still failed according to the developer tools in Chrome and FireFox.

REVERB_APP_ID=***********
REVERB_APP_KEY=***********
REVERB_APP_SECRET=***********
REVERB_HOST=ws.example.lnl
REVERB_PORT=6001
REVERB_SCHEME=https

REVERB_SERVER_HOST=0.0.0.0
REVERB_SERVER_PORT=6001

REVERB_TLS_PEM_FILE=/home/vagrant/code/example/storage/app/ssl/ws.example.lnl.pem

The pem file is created by the ca.homestead file, the example.crt file and the example.key file.

The Chrome DevTools window reports WebSocket connection to 'wss://ws.example.lnl:6001/app/...' failed:

First line in the trace states the createWebsocket function.

Anybody tips how to debug this? Looking at the problem for hours now.

0 likes
8 replies
LaryAI's avatar
Level 58

It seems like you're trying to set up a secure WebSocket connection (wss) with Laravel Websockets (which I assume you're referring to as "Reverb") on a Homestead environment. Here are some steps you can take to debug and resolve the issue:

  1. Verify SSL Certificate: Ensure that the SSL certificate is correctly installed and recognized by the browser. You can check this by visiting https://ws.example.lnl:6001 in your browser and seeing if there are any SSL-related warnings or errors.

  2. Check WebSocket Configuration: Verify that the WebSocket server is configured to use SSL by checking the .pem file path and ensuring that it is accessible by the WebSocket server.

  3. Firewall and Ports: Ensure that the port 6001 is open and not blocked by any firewall. Since you're using Homestead, it should be open by default, but it's worth checking.

  4. WebSocket Server Logs: Check the logs of the WebSocket server for any errors. If you're using Laravel Websockets, you can start the server in debug mode to get more verbose output:

php artisan websockets:serve --debug
  1. Browser Console: The browser's console and network tabs can provide more information about the error. Look for any error messages related to the WebSocket connection.

  2. WebSocket Client Configuration: Ensure that the client-side WebSocket connection is correctly configured to connect to wss://ws.example.lnl:6001. The URL should match the server configuration.

  3. Test with a WebSocket Client: Use a WebSocket client like wscat to test the connection from your local machine or another server. This can help determine if the issue is with the browser or the server.

wscat -c wss://ws.example.lnl:6001
  1. Homestead.yaml Configuration: Double-check your Homestead.yaml file to ensure that the ports are correctly mapped and SSL is configured for the site.

  2. Hosts File: Ensure that ws.example.lnl is mapped to the correct IP in your /etc/hosts file.

  3. SSL Certificate Permissions: Make sure that the SSL certificate files have the correct permissions and are readable by the user that runs the WebSocket server.

If you've gone through all these steps and the issue persists, you might want to provide more specific error messages or logs that could give further insight into the problem. Remember that the actual domain names and paths should match your specific setup, and the example domain ws.example.lnl should be replaced with your actual domain.

bhosted's avatar

Still not stable. One of the queue workers sends notifications to Reverb (running on the same server), but the call results in a cURL error:

#[2024-04-22 09:45:33] local.ERROR: cURL error 56: OpenSSL SSL_read: error:0A000126:SSL routines::unexpected eof while reading, errno 0 (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://ws.example.lnl:6001/apps/*********/events?auth_key=*****************&auth_timestamp=1713771933&auth_version=1.0&body_md5=*****************&auth_signature=***************** {"exception":"[object] (GuzzleHttp\Exception\RequestException(code: 200): cURL error 56: OpenSSL SSL_read: error:0A000126:SSL routines::unexpected eof while reading, errno 0 (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://ws.bhosted.lnl:6001/apps/*********/events?auth_key=*****************&auth_timestamp=1713771933&auth_version=1.0&body_md5=*****************&auth_signature=***************** at /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:211) [stacktrace] #0 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(158): GuzzleHttp\Handler\CurlFactory::createRejection() #1 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(110): GuzzleHttp\Handler\CurlFactory::finishError() #2 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(47): GuzzleHttp\Handler\CurlFactory::finish() #3 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke() #4 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(48): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}() #5 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(64): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}() #6 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/Middleware.php(31): GuzzleHttp\PrepareBodyMiddleware->__invoke() #7 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(71): GuzzleHttp\Middleware::GuzzleHttp\{closure}() #8 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/Middleware.php(63): GuzzleHttp\RedirectMiddleware->__invoke() #9 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/HandlerStack.php(75): GuzzleHttp\Middleware::GuzzleHttp\{closure}() #10 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/Client.php(333): GuzzleHttp\HandlerStack->__invoke() #11 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/Client.php(169): GuzzleHttp\Client->transfer() #12 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/Client.php(189): GuzzleHttp\Client->requestAsync() #13 /home/vagrant/code/bhosted/vendor/guzzlehttp/guzzle/src/ClientTrait.php(95): GuzzleHttp\Client->request() #14 /home/vagrant/code/bhosted/vendor/pusher/pusher-php-server/src/Pusher.php(776): GuzzleHttp\Client->post() #15 /home/vagrant/code/bhosted/vendor/pusher/pusher-php-server/src/Pusher.php(441): Pusher\Pusher->post() #16 /home/vagrant/code/bhosted/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php(161): Pusher\Pusher->trigger() #17 /home/vagrant/code/bhosted/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(237): Illuminate\Broadcasting\Broadcasters\PusherBroadcaster->Illuminate\Broadcasting\Broadcasters\{closure}() #18 /home/vagrant/code/bhosted/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php(160): Illuminate\Support\Collection->each() #19 /home/vagrant/code/bhosted/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php(92): Illuminate\Broadcasting\Broadcasters\PusherBroadcaster->broadcast() #20 /home/vagrant/code/bhosted/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Broadcasting\BroadcastEvent->handle() #21 /home/vagrant/code/bhosted/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #22 /home/vagrant/code/bhosted/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure() ...

bhosted's avatar

Any help would really be appreciated. Working on this problem for 2 days now, and I'm not making any progress in solving it. It keeps coming back to this same error message over and over again.

BabaT's avatar

@bhosted Hello, please were you able to get this problem sorted? I am currently having exact issue.

bhosted's avatar

@Firemaps No, still having the problem. I did create a workaround. When javascript "detects" a dead connection, it does a simple get on the reverb server (GET https://ws.example.lnl:6001). The next attempt to connect to the reverb server is then successfull.

Please or to participate in this conversation.