title: Problem using websockets from docker container and node
body: <p>I have node running from a docker container and I tried to write some websocket example. But I an getting the next problem:</p>
  
  <pre><code>root@7cd5a41c8eea:/application/webSocketEx# node
  &gt; var connection = new WebSocket('ws://html5rocks.websocket.org/echo', ['soap', 'xmpp']);
  ReferenceError: WebSocket is not defined
  &gt; const WebSocket = require('ws');
  undefined
  &gt; var ws = new WebSocket("ws://www.websocket.org");
  undefined
  &gt; { Error: Unexpected server response: 404
  
      at ClientRequest.req.on (/application/webSocketEx/node_modules/ws/lib/websocket.js:579:7)
      at ClientRequest.emit (events.js:182:13)
      at ClientRequest.EventEmitter.emit (domain.js:460:23)
      at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:555:21)
      at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
      at Socket.socketOnData (_http_client.js:441:20)
      at Socket.emit (events.js:182:13)
      at Socket.EventEmitter.emit (domain.js:460:23)
      at addChunk (_stream_readable.js:283:12)
      at readableAddChunk (_stream_readable.js:264:11)
    domainEmitter:
     WebSocket {
       domain:
        Domain {
          domain: null,
          _events: [Object],
          _eventsCount: 3,
          _maxListeners: undefined,
          members: [] },
       _events: {},
       _eventsCount: 0,
       _maxListeners: undefined,
       readyState: 2,
       protocol: '',
       _binaryType: 'nodebuffer',
       _closeFrameReceived: false,
       _closeFrameSent: false,
       _closeMessage: '',
       _closeTimer: null,
       _closeCode: 1006,
       _extensions: {},
       _receiver: null,
       _sender: null,
       _socket: null,
       _bufferedAmount: 0,
       _isServer: false,
       _redirects: 0,
       url: 'ws://www.websocket.org',
       _req:
        ClientRequest {
          domain: [Domain],
          _events: [Object],
          _eventsCount: 5,
          _maxListeners: undefined,
          output: [],
          outputEncodings: [],
          outputCallbacks: [],
          outputSize: 0,
          writable: true,
          _last: true,
          chunkedEncoding: false,
          shouldKeepAlive: true,
          useChunkedEncodingByDefault: false,
          sendDate: false,
          _removedConnection: false,
          _removedContLen: false,
          _removedTE: false,
          _contentLength: 0,
          _hasBody: true,
          _trailer: '',
          finished: true,
          _headerSent: true,
          socket: [Socket],
          connection: [Socket],
          _header:
           'GET / HTTP/1.1\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: 2c4HivAKv2OJ6rO7qYyaNA==\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nSec-WebSocket-Extensions: permessage-deflate; client_max_window_bits\r\nHost: www.websocket.org\r\n\r\n',
          _onPendingData: [Function: noopPendingOutput],
          agent: undefined,
          socketPath: undefined,
          timeout: undefined,
          method: 'GET',
          path: '/',
          _ended: false,
          res: [IncomingMessage],
          aborted: 1563389938612,
          timeoutCb: null,
          upgradeOrConnect: false,
          parser: [HTTPParser],
          maxHeadersCount: null,
          [Symbol(isCorked)]: false,
          [Symbol(outHeadersKey)]: [Object] } },
    domain:
     Domain {
       domain: null,
       _events:
        { removeListener: [Function: updateExceptionCapture],
          newListener: [Function: updateExceptionCapture],
          error: [Function: debugDomainError] },
       _eventsCount: 3,
       _maxListeners: undefined,
       members: [] },
    domainThrown: false }
  &gt; 
  </code></pre>
  
  <p>Is there a configuration parameter I am missing to use websockets from a docker container and node? I installed ws using  npm install ws   already. I have the feeling I need to open a port for the docker container but I do not understand which one.</p>
  
  <p>Thanks</p>