title: Socket.io works with localhost but not on Heroku server
body: <p>I am currently trying to use socket.io and a node.js server to communicate with a Unity script. I have everything hooked up and working with localhost, but for some reason when I port it to my Heroku server it can't connect. I'm assuming it might have something to do with the URL's? I'm new to socket.io so any help would be appreciated. </p>
  
  <p>My node.js server:</p>
  
  <pre><code>var express = require('express');
  var app = express();
  var expressWs = require('express-ws')(app);
  var path = require('path');
  
  var server = require('http').createServer(app);
  var io = require('socket.io')(server);
  
  io.on('connection', function(socket) {
      socket.on('beep', function(){
          socket.emit("speed", {data: 5});
          console.log('beep recieved');
      });
  
      socket.on('change-speed', function(data) {
          console.log('change speed recieved: ' + data);
          socket.emit("speed", {newSpeed: data});
      });
  
      socket.on('ios-connection', function(data) {
          console.log('ios connection with message: ' + data);
      });
  
  });
  
  app.set('port', (process.env.PORT || 5000));
  
  app.listen(app.get('port'), function() {
      console.log('Node app is running on port', app.get('port'));
  });
  </code></pre>
  
  <p>My connection URL:</p>
  
  <pre><code>ws://&lt;heroku app name&gt;.herokuapp.com:5000/socket.io/?EIO=4&amp;transport=websocket
  </code></pre>