title: Server.listeners is not a function
body: <p>I'm follow <a href="https://tutorialedge.net/typescript/angular/angular-socket-io-tutorial/#installing-socket-io" rel="noreferrer">this websockets tutorial</a> to learn how to integrate Socket.IO into an Angular project. I've followed the steps exactly but when I try to run my websockets server project I get the following error:</p>
  
  <blockquote>
    <p>TypeError: server.listeners is not a function
        at Server.attach (\ws-server\node_modules\engine.io\lib\server.js:455:26)</p>
  </blockquote>
  
  <p>At line 455 of server.js we see this code</p>
  
  <pre><code>  // cache and clean up listeners
    var listeners = server.listeners('request').slice(0);
  </code></pre>
  
  <p>I am confused as to why I'm seeing this. I've updated both express and Socket.IO and I'm still seeing the same issue. I can provide the angular code if needed but I don't think it's related. </p>
  
  <p>Here is what my server code looks like</p>
  
  <pre><code>let app = require('express')();
  let http = require('http').Server(app);
  let io = require('socket.io')('http');
  
  io.on('connection', (socket) =&gt;{
      //Log when a user connects
      console.log('user connected');
  
      //Log when a client disconnects
      socket.on('disconnect', function(){
          console.log('user disconnected');
      });
  
      //When we receive a message event from our client, print out the 
      //contents of that message and echo it back to our clients using emit()
  
      socket.on('message', (message)=&gt;{
          console.log('message received: ' + message);
          io.emit('message', {type:'new-message', text: message});
      });
  });
  
  //initialize server on port 5000
  http.listen(5000, () =&gt;{
      console.log('started on port 500');
  });
  </code></pre>
  
  <p>And here is the full error</p>
  
  <blockquote>
    <p>TypeError: server.listeners is not a function
        at Server.attach (C:\Users***\Documents\poker game\ws-server\node_modules\engine.io\lib\server.js:455:26)
        at Function.attach (C:\Users***\Documents\poker game\ws-server\node_modules\engine.io\lib\engine.io.js:124:10)
        at Server.initEngine (C:\Users***\Documents\poker game\ws-server\node_modules\socket.io\lib\index.js:310:21)
        at C:\Users***\Documents\poker game\ws-server\node_modules\socket.io\lib\index.js:295:10
        at Encoder.encode (C:\Users***\Documents\poker game\ws-server\node_modules\socket.io-parser\index.js:135:5)
        at Server.listen.Server.attach (C:\Users***\Documents\poker game\ws-server\node_modules\socket.io\lib\index.js:290:16)
        at new Server (C:\Users***\Documents\poker game\ws-server\node_modules\socket.io\lib\index.js:59:17)
        at Server (C:\Users***\Documents\poker game\ws-server\node_modules\socket.io\lib\index.js:44:41)
        at Object. (C:\Users***\Documents\poker game\ws-server\index.js:3:30)
        at Module._compile (module.js:652:30)</p>
  </blockquote>