Socket.io returning Uncaught RangeError and literal javascript code on server, but works fine locally

I'm writing a server/client using Node.js and Socket.io and hosting it with OpenShift. The client and server are connecting properly when I run the code locally, but once on OpenShift, the client is refusing to connect.

Locally, the request http://127.0.0.1:8000/socket.io/?EIO=2&transport=polling&t=1409632875121-110 will return an appropriate JSON response. On the server however, the request is (EDIT) timing out.

(EDIT: formerly the error was returning literally the code content of socket.io/index.js and throwing: "Uncaught RangeError: Invalid string length" at sockets.io.js:3947)

Server

    self.server = require('http').createServer(self.app);
    self.io = require('socket.io').listen(self.server);
    self.io.set('transports', ['websocket', 'polling', 'xhr-polling', 'jsonp-polling']);

    ...

    self.routes['/myip'] = function(req, res){
        res.setHeader('Content-Type', 'text/html');
        res.send("" + self.ipaddress);
    }

    ...

    self.app.listen(self.port, self.ipaddress, function() {
        console.log('%s: Node server started on %s:%d ...',
                    Date(Date.now() ), self.ipaddress, self.port);
    });

    self.server.listen("8000", self.ipaddress, function(){
        console.log("Starting another server");
    });

Client

    var request = new XMLHttpRequest();
    request.open('GET', '/myip', false);  // I want it synchronous
    request.send(null);

    if (request.status === 200) {
        var ip = request.responseText
        console.log(ip);
        socket = io.connect("http://" + ip + ":8000");
    }else{
        socket = io.connect();
        alert('There were issues connecting to server. Expect odd issues.');
    }
    socket.emit('set-host');

Any thoughts as to why this is working on localhost but not when hosted?

EDIT: I believe the "string length" error is really a symptom of the client not finding a server running. I changed the code (reflected above) to ensure that the IP the client connects to is the same as on the server. Still, works locally. Breaks down when uploaded.

EDIT 2: Using the IP address or a the literal URL to connect on the client is both giving a connection timeout error.

I think you should be using your openshift url (something like app-domain.rhcloud.com) not the ip address of the server, since everything is hosted using virtual hosts. Also, your server should listen on port 8080, not 8000, but the client should access it on port 8000, using your openshift url.