I've got a Node.js app that runs fine locally, but when I push it up to OpenShift it gives me this error in the dev console:
WebSocket connection to 'ws://myapp-mydomain.rhcloud.com/socket.io/?EIO=3&transport=websocket&sid=mpKjro8KjQ5dIg0GAAAE' failed: Error during WebSocket handshake: Unexpected response code: 400
It's a little multiplayer "game", you and any other players connected are cubes that can move around and can see each other's movement etc. I use Node and socket.io to get the player positions and send the new coordinates to other players, but when I host it on OpenShift it gives me the error above. The weird thing is that it almost works i.e. you can see the other players move around, except it's very laggy and slow. The same app worked fine on Scalingo hosting, so it must be an OpenShift thing.
This is my client side code for initiating socket.io:
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io();
</script>
And server:
var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
app.get('/', function(req, res){
res.sendFile('index.html');
});
this.ipaddress = process.env.OPENSHIFT_NODEJS_IP;
this.port = process.env.OPENSHIFT_NODEJS_PORT || 8000;
http.listen( port, ipaddress, function(){
console.log('listening on:' + port);
});