title: How to use socket.io in node.js with ES6 syntax
body: <p>I want to make a chat application using oop architecture and javascript ES6 syntax. I don't know how to initialize socket.io. I did not find any help.</p>
  <p>Here is my code.</p>
  <pre><code>import express from 'express';
  import http from 'http';
  import config from 'config';
  import SocketIO from 'socket.io'
  
  const app = express();
  const port = config.PORT;
  app.set('port', port);
  const server = http.createServer(app);
  var io = SocketIO(server);
  io.on('connection', socket =&gt; {
      console.log(&quot;Socket connected&quot;);
      
  });
  
  server.listen(port, () =&gt; console.log(`API running on localhost:${port}`));
  </code></pre>
  <p>I am trying to connect socket using socket-client-tool, it shows connection timeout.</p>