title: WebSocket connection to 'ws://localhost:8080/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
body: <p>I am getting no Websocket connection between client script and server.</p>
  
  <p>It is working fine in my local environment.</p>
  
  <p>Also I am following this <a href="http://socketo.me/docs/push" rel="nofollow noreferrer">link</a>.</p>
  
  <p>Here's a server script that initializes the websocket server and listens for the client connection to <code>8080</code> port.</p>
  
  <pre><code>public function run()
  {
      $loop   = Factory::create();
      $pusher = new Pusher;
      $context = new Context($loop);
      $pull = $context-&gt;getSocket(ZMQ::SOCKET_PULL);
      $pull-&gt;bind('tcp://127.0.0.1:5555'); // Binding to 127.0.0.1 means the only client that can connect is itself
      $pull-&gt;on('message', array($pusher, 'onBlogEntry'));
  
      // Set up our WebSocket server for clients wanting real-time updates
      $webSock = new Server('0.0.0.0:8080', $loop); // Binding to 0.0.0.0 means remotes can connect
      $webServer = new IoServer(
          new HttpServer(
              new WsServer(
                  new WampServer(
                      $pusher
                  )
              )
          ),
          $webSock
      );
  
      $loop-&gt;run();
  </code></pre>
  
  <p>And here's the client script:</p>
  
  <pre><code>var conn = new ab.Session('ws://localhost:8080',
      function() {
          /* subscribe to following topics */
          conn.subscribe('new_order', function(topic, data) ..
  </code></pre>
  
  <p>Again, this is working fine in the local setup.</p>
  
  <p>Also to note, my application is hosted using a specified port from docker container.</p>
  
  <pre><code>http://192.168.12.52:8094/xyz/new/....
  </code></pre>
  
  <p>I also tried specifying the IP in the client script:</p>
  
  <pre><code>var conn = new ab.Session('ws://192.168.12.52:8080',
      function() {
          /* subscribe to following topics */
          conn.subscribe('new_order', function(topic, data) ...
  </code></pre>
  
  <p>In which case I get the following error:</p>
  
  <pre><code>WebSocket connection to 'ws://192.168.11.32:8080/' failed: Error during WebSocket handshake: Unexpected response code: 403
  </code></pre>
  
  <p>What is missing here?</p>