I am new to node.js and have got it working fine on localhost.
For localhost I am using xampp, then have a .bat file which runs node app.js (runs the server).
It works perfectly and runs the game as you can see below with both characters appearing on each screen and the positions being communicated over the server.
Then when I try and run it on the server after using ssh to run "node app.js" it outputs
info - socket.io started
like it does when I run it on local host, but then when I run the app I get the following errors (I had these errors previously when trying to get it working on local host - they appear when the server doesn't run properly..):
Any help would be great, Thanks!
on the client side I have this code in the html file:
<script src="http://localhost:8080/socket.io/socket.io.js"></script>
and
var socket = io.connect('http://localhost:8080');
which is then used to run all the functions. e.g.
socket.on('message', function (data) {
var player = ig.game.getEntitiesByType( EntityPlayer )[0];
if(player)
{
player.messagebox = player.messagebox + '\n' + data + ' disconnected';
}
}); `
on the server side I have the code:
var app = require('http').createServer(handler), io = require('socket.io').listen(app), fs = require('fs') app.listen(8080);