title: Beyondcode Laravel Websockets : failed: WebSocket is closed before the connection is established
body: <p>Local websockets is running like a charm but on production I keep getting the error in the title.</p>
  
  <p>Some background information I'm using the websocket package: beyondcode/laravel-websockets. I'm running 'php artisan websockets:serve --port=6004' with supervisor. I also made sure port 6004 is open. </p>
  
  <p>In production I tried the settings with and without SSL both gave the error in the title.</p>
  
  <h3>Settings with SSL:</h3>
  
  <p><strong>My echo settings:</strong></p>
  
  <pre><code>window.Echo = new Echo({
      broadcaster: 'pusher',
      key: process.env.MIX_PUSHER_APP_KEY,
      wsHost: window.location.hostname,
      wsPort: 6004,
      wssPort: 6004,
      disableStats: true,
      enabledTransports: ['ws', 'wss'],
  });
  </code></pre>
  
  <p><strong>My pusher settings:</strong></p>
  
  <pre><code>'pusher' =&gt; [
              'driver' =&gt; 'pusher',
              'key' =&gt; env('PUSHER_APP_KEY'),
              'secret' =&gt; env('PUSHER_APP_SECRET'),
              'app_id' =&gt; env('PUSHER_APP_ID'),
              'options' =&gt; [
                  'cluster' =&gt; env('PUSHER_APP_CLUSTER'),
                  'encrypted' =&gt; true,
                  'host' =&gt; '127.0.0.1',
                  'port' =&gt; 6004,
                  'scheme' =&gt; 'https',
                  'curl_options' =&gt; [
                      CURLOPT_SSL_VERIFYHOST =&gt; 0,
                      CURLOPT_SSL_VERIFYPEER =&gt; 0,
                  ]
              ],
          ],
  </code></pre>
  
  <p><strong>My websockets settings:</strong></p>
  
  <pre><code>'apps' =&gt; [
          [
              'id' =&gt; env('PUSHER_APP_ID'),
              'name' =&gt; env('APP_NAME'),
              'key' =&gt; env('PUSHER_APP_KEY'),
              'secret' =&gt; env('PUSHER_APP_SECRET'),
              'enable_client_messages' =&gt; true,
              'enable_statistics' =&gt; true,
          ],
      ],
  
      'ssl' =&gt; [
          /*
           * Path to local certificate file on filesystem. It must be a PEM encoded file which
           * contains your certificate and private key. It can optionally contain the
           * certificate chain of issuers. The private key also may be contained
           * in a separate file specified by local_pk.
           */
          'local_cert' =&gt; base_path().'/ssl/server.crt',
  
          /*
           * Path to local private key file on filesystem in case of separate files for
           * certificate (local_cert) and private key.
           */
          'local_pk' =&gt; base_path().'/ssl/server.pem',
  
          /*
           * Passphrase for your local_cert file.
           */
          'passphrase' =&gt; null,
          'verify_peer' =&gt; false,
      ],
  </code></pre>
  
  <h3>Settings without SSL:</h3>
  
  <p><strong>My echo settings:</strong></p>
  
  <pre><code>window.Echo = new Echo({
      broadcaster: 'pusher',
      key: process.env.MIX_PUSHER_APP_KEY,
      wsHost: window.location.hostname,
      wsPort: 6004,
      disableStats: true,
      enabledTransports: ['ws', 'wss'],
  });
  </code></pre>
  
  <p><strong>My pusher settings:</strong></p>
  
  <pre><code>'pusher' =&gt; [
              'driver' =&gt; 'pusher',
              'key' =&gt; env('PUSHER_APP_KEY'),
              'secret' =&gt; env('PUSHER_APP_SECRET'),
              'app_id' =&gt; env('PUSHER_APP_ID'),
              'options' =&gt; [
                  'cluster' =&gt; env('PUSHER_APP_CLUSTER'),
                  'encrypted' =&gt; false,
                  'host' =&gt; '127.0.0.1',
                  'port' =&gt; 6004,
                  'scheme' =&gt; 'http',
              ],
          ],
  </code></pre>
  
  <p><strong>My websockets settings:</strong></p>
  
  <pre><code>'apps' =&gt; [
          [
              'id' =&gt; env('PUSHER_APP_ID'),
              'name' =&gt; env('APP_NAME'),
              'key' =&gt; env('PUSHER_APP_KEY'),
              'secret' =&gt; env('PUSHER_APP_SECRET'),
              'enable_client_messages' =&gt; true,
              'enable_statistics' =&gt; true,
          ],
      ],
  
      'ssl' =&gt; [
          /*
           * Path to local certificate file on filesystem. It must be a PEM encoded file which
           * contains your certificate and private key. It can optionally contain the
           * certificate chain of issuers. The private key also may be contained
           * in a separate file specified by local_pk.
           */
          'local_cert' =&gt; null,
  
          /*
           * Path to local private key file on filesystem in case of separate files for
           * certificate (local_cert) and private key.
           */
          'local_pk' =&gt; null,
  
          /*
           * Passphrase for your local_cert file.
           */
          'passphrase' =&gt; null,
  
      ],
  
  </code></pre>