title: Cannot GET /socket.io/?EIO=3&transport=polling&t=LdmmKYz
body: <p>I have a problem with my node.js server and my ionic 2 with socket.io (websocket) communication.</p>
  
  <p>My ionic app sends this error:</p>
  
  <pre><code>Cannot GET /socket.io/?EIO=3&amp;transport=polling&amp;t=LdmmKYz
  </code></pre>
  
  <p>and this is my code, I didn't find my mistake.</p>
  
  <p>my node.js code (using express):</p>
  
  <pre><code>var express = require('express');
  var app = express();
  var http = require('http').Server(app);
  var io = require('socket.io')(http);
  
  app.use( (req, res, next) =&gt; {
     res.header("Access-Control-Allow-Origin", "http://localhost:8100"); //The ionic server
     res.header("Access-Control-Allow-Credentials", "true");
     res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
     next();
  });
  var port = Number(process.env.PORT || 8810);
  
  io.on('connection', function (socket) {
      console.log('ping-pong started');
      socket.emit('news', { hello: 'world' });
      socket.on('my other event', function (data) {
          console.log(data);
      });
  });
  </code></pre>
  
  <p>and this is the ionic 2 app code (inside the constructor):</p>
  
  <pre><code>this.connect = () =&gt; {
      this.socket = io('http://localhost:8810');
      console.log('socket started');
  
      this.socket.emit('connect', {data: 'data'});
          this.socket.on('news', (data)=&gt;{
          console.log(data);
         this.socket.emit('my other event', { my: 'data' });
      });
  }
  this.connect();
  </code></pre>
  
  <p>What am I missing?</p>