title: Laravel websockets connection failed
body: <p>I've got a Laravel 8 API project along with a Nuxt JS front-end that uses Laravel Echo. I'm installed the Laravel Websockets server and have everything working just fine with the Pusher replacement config:</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; 6001,
          'scheme' =&gt; 'http'
      ],
  ],
  </code></pre>
  <p>It's also worth noting here that I've also tried:</p>
  <pre><code>'options' =&gt; [
      ...
      'port' =&gt; 6001,
      'scheme' =&gt; 'https'
  ],
  </code></pre>
  <p>and...</p>
  <pre><code>'options' =&gt; [
      ...
      'port' =&gt; 443,
      'scheme' =&gt; 'https'
  ],
  </code></pre>
  <p>However, when I deploy to my CentOS 8 server and start the websockets server with <code>php artisan websockets:serve</code> <em>(I'm in debug mode)</em> and I try to connect, I'm getting a connection failed error. I'm using the default port of <code>6001</code> and default host of <code>0.0.0.0</code>, the error I get from my front-end is:</p>
  <blockquote>
  <p>WebSocket connection to 'wss://127.0.0.1/app/local?protocol=7&amp;client=js&amp;version=7.0.3&amp;flash=false' failed:</p>
  </blockquote>
  <p>My front-end is for example: <a href="https://example-gui.example.com/" rel="nofollow noreferrer">https://example-gui.example.com/</a> whilst my running API is on <a href="https://example-api.example.com/" rel="nofollow noreferrer">https://example-api.example.com/</a>, both on the same server, and the same server as the running websockets server.</p>
  <p>I'm using Cloudflare for HTTPs, and I'm not sure whether I need to change anything with the host?</p>
  <p>I originally had the connection like this:</p>
  <blockquote>
  <p>'wss://127.0.0.1/app/local?protocol=7&amp;client=js&amp;version=7.0.3&amp;flash=false', when I run <code>netstat -tulnp</code> I do indeed see that port <code>6001</code> is in there.</p>
  </blockquote>
  <p>What am I missing to connect in production?</p>
  <p>I'm stuck in knowing how to get it to connect!</p>