Socket.IO with Node.js on Heroku

I have Socket.IO set up with node.js and it works on my local development machine by listening/connecting to port 8000 (or another port that is not the port that my server is running on).

When I try to do the same thing on heroku, my client-side script import fails.

I have tried relative path

<script src="/socket.io/socket.io.js"></script>

I have also tried to bind to port 8000 on heroku and use the full pathname

<script type="text/javascript">
         var href = document.location.protocol + document.location.hostname + ':8000/socket.io/socket.io.js';
         console.log("href = " + href);
         document.write("<script src=" + href + "><\/script>");
     </script>

I did read that websockets don't work on heroku, so I have the following code in my after_start.js file on the backend. Do I need to do something else in addition to configuring socket.io to use transports/polling?

var port = process.env.PORT || 8000; //I've tried hardcoding to 8000 and using process.env.PORT and then I used the relative path for the script import
io = require('socket.io').listen(port);
//Configue io to work with heroku
io.configure(function () { 
    io.set("transports", ["xhr-polling"]); 
    io.set("polling duration", 10); 
});

I get this error when I load my heroku app:

GET http://<myAppName>.herokuapp.com/socket.io/socket.io.js 404 (Not Found) 

Edit: I am actually using geddy mvc framework and would like to get this working how I have it set up (basically just like socket.io) on heroku and I found this answer that makes it seem like I can use it similarly: GeddyJS & socket.io: catching and emitting events from server side

Ahah! I forgot to turn on geddy's realtime settings in the config.

Here is what I did:

added

, socketIo: true
, realtime: true

to the config file

Added

geddy.io.configure(function () { 
    geddy.io.set("transports", ["xhr-polling"]); 
    geddy.io.set("polling duration", 10); 
});

to after_start.js file

Used geddy.io.sockets.emit( to send events from backend.

<script src="/socket.io/socket.io.js"></script> to import io on frontend

and

var href = document.location.protocol + document.location.hostname;
console.log('href = ' + href);
var socket = io.connect(href);

To open a socket from the frontend.