title: Laravel Websockets Error in connection Error during WebSocket handshake: Unexpected response code: 404
body: <p>Im trying to set up laravel websockets on localhost using <a href="https://github.com/beyondcode/laravel-websockets" rel="nofollow noreferrer">this library</a></p>
  <p>And I am getting this error
  <a href="https://i.stack.imgur.com/C8gjJ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C8gjJ.jpg" alt="enter image description here" /></a></p>
  <p>I have installed the package and started the service on my localhost running <code>php artisan websockets:serve</code></p>
  <p>my Bootstrap.js is:</p>
  <pre><code>import Echo from &quot;laravel-echo&quot;
  
  window.Pusher = require('pusher-js');
  
  window.Echo = new Echo({
      broadcaster: 'pusher',
      key: process.env.MIX_PUSHER_APP_KEY,
      wsHost: window.location.hostname,
      wsPort: 6001,
      disableStats: true,
  });
  window.Echo.channel('DemoChannel').listen('WebsocketDemoEvent',(e) =&gt; function() {
      console.log(e);
  });
  </code></pre>