title: Express-Ws closing connection closes unexpectedly
body: <p>I am trying to use express-ws to enable websocket for express. I have two express servers and both uses ws. The code for setting up the ws is exactly the same for both servers (except the path names). One of the server is working as expected. The other one, closes as soon as a connection is established with exit code 1005. As far as I have researched, I have found 1005 to be described as a special error code to be returned in cases of unexpected disconnection. I have tried logging inside the ws route handler and, it prints nothing. On 'connection' handler is also not fired. </p>
  
  <pre><code>const expressWs = require('express-ws')(server, null { wsOptions: { clientTracking: true } });
  //&lt;... HTTP route setup and middleware mounting &gt;
  server.ws('/',(sck, req)=&gt; {
      sck.on('connection', (s1) =&gt; {
         console.dir(s1);
         console.log('Connected')
      });
      let interval = setInterval(() =&gt; {
        expressWs.getWss().clients.forEach(s =&gt; {
          if(s.readyState === WS_CONSTANTS.Open) {
              s.ping(null, false, null);
          }
        });
      }, WS_HEARTBEAT_DELAY);
     sck.on('close', (ev) =&gt; {
        console.dir(ev);
        clearInterval(interval);
     });
  //&lt;... Other code for route handling &gt;
  </code></pre>
  
  <p>As you can see, I implemented a 'heartbeat' technique for sending a ping to client to keep connection alive. As stated, it worked perfectly for only one of the server. I am very confused as to why 1005 is returned.</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>Following this post <a href="https://github.com/websockets/ws/issues/1257" rel="nofollow noreferrer">here</a>, I tried updating ws package for express-ws manually. This still did not solve the issue and the connection is still dropped with 1005 as reported earlier.</p>