ehabafia's avatar
Level 37

Reverb didn't work in Forge

I was able to run reverb in an https://site.test locally with no issues, but when I deployed it to forge. I tried to run reverb from Forge portal, which is gave me 3 default values that I kept them as is.

But then when I tried to broadcast, it kept giving me the error of:

WebSocket connection to 'wss://ws.staging.mysitename.com:80/app/kreze7fzppbfsidkgbdo?protocol=7&client=js&version=8.4.0-rc2&flash=false' failed: 

although the default values that gave me when I switched reverb on was port 8080

Can someone help me on what I did wrong?

Thank you,

0 likes
4 replies
LaryAI's avatar
Level 58

It looks like you're encountering an issue with WebSocket connections when deploying your application to Forge. The error message suggests that the WebSocket connection is failing, which could be due to several reasons such as incorrect port configuration, SSL issues, or firewall settings.

Here are some steps to troubleshoot and resolve the issue:

  1. Check WebSocket Port Configuration: Ensure that the WebSocket server is running on the correct port. By default, WebSockets often use port 6001. If you are using a different port, make sure it is correctly configured in your broadcasting settings.

  2. Update Broadcasting Configuration: Verify that your broadcasting.php configuration file has the correct settings for your WebSocket server. Here is an example configuration for Pusher:

    'pusher' => [
        'driver' => 'pusher',
        'key' => env('PUSHER_APP_KEY'),
        'secret' => env('PUSHER_APP_SECRET'),
        'app_id' => env('PUSHER_APP_ID'),
        'options' => [
            'cluster' => env('PUSHER_APP_CLUSTER'),
            'useTLS' => true,
            'host' => env('PUSHER_HOST', '127.0.0.1'),
            'port' => env('PUSHER_PORT', 6001),
            'scheme' => env('PUSHER_SCHEME', 'https'),
            'encrypted' => true,
        ],
    ],
    
  3. Check SSL Configuration: Ensure that your WebSocket server is configured to use SSL if your site is served over HTTPS. This is important because browsers will block non-secure WebSocket connections on secure pages.

  4. Firewall and Security Groups: Make sure that the port used by your WebSocket server is open in your firewall and security groups. For example, if you are using AWS, you need to open the port in the security group associated with your EC2 instance.

  5. Forge Configuration: If you are using Laravel Forge, ensure that the WebSocket server is properly configured in the Forge dashboard. You might need to specify the correct port and ensure that the WebSocket server is running.

  6. Check WebSocket Server Logs: Look at the logs of your WebSocket server to see if there are any errors or warnings that could give you more insight into what might be going wrong.

Here is an example of how you might configure your .env file for Pusher:

PUSHER_APP_ID=your-app-id
PUSHER_APP_KEY=your-app-key
PUSHER_APP_SECRET=your-app-secret
PUSHER_APP_CLUSTER=your-app-cluster
PUSHER_HOST=your-websocket-server-host
PUSHER_PORT=6001
PUSHER_SCHEME=https

By following these steps, you should be able to identify and resolve the issue with your WebSocket connection on Forge. If the problem persists, consider providing more details about your setup and any additional error messages you might be seeing.

nexxai's avatar

I can't say for sure that this is your problem but you've specified the use of "wss" which are secure Websockets (e.g. connections protected with TLS), however based on your error message, the connection attempt is happening on port 80, which is not typically associated with TLS connections; typically secured connections happen on port 443. You might want to investigate that.

ehabafia's avatar
Level 37

the message from Forge said that they will proxy the port, so, I am not sure.

ehabafia's avatar
ehabafia
OP
Best Answer
Level 37

Unfortunately, I moved to Pusher.com instead.

Please or to participate in this conversation.