title: NodeJS, React on Heroku, Socket.io gives error
body: <p><strong>Help pls!</strong> I am making a website with Node/Express and React on Heroku. 
  Server.js serves an expresshandlebar template on client side, rendering App.js</p>
  
  <p>So far everything was working, until I tried to implement Socket.IO. Socket.IO works perfectly on localhost but gives an error on Heroku:</p>
  
  <p><strong>VM63:35 WebSocket connection to 'ws://mysite:8080/socket.io-client/?EIO=3&amp;transport=websocket' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET</strong></p>
  
  <p>Here is the relevant portion of the code:</p>
  
  <p><strong>Server.js</strong></p>
  
  <pre><code>var express = require('express'),
  var port = process.env.PORT || 8080;
  var httpServer = require('http').createServer(app);
  httpServer.listen(port)
  io.on('connection', function (socket) {
  console.log('Connection started');});
  </code></pre>
  
  <p><strong>App.js</strong></p>
  
  <pre><code>var io = require('socket.io-client');
  var new_socket = io.connect();
  </code></pre>
  
  <hr>
  
  <p>I have read many sites, and tried many alternatives, such as:
  1) setting on both client and server socket.io 'path' and 'transports'</p>
  
  <pre><code>path: '/socket.io-client'
  transports: ['websocket']
  </code></pre>
  
  <p>2) Trying WebSockets as recommended by Heroku. This throws another error 'error 503'</p>