My little game server works fine when run locally, but when I put it up on my linode I get errors.
Full source: https://github.com/raimondi1337/null-terminus
Relevent Server code:
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var clients = {};
app.get('/', function(req, res){
res.sendFile(__dirname + '/index.html');
});
http.listen(3000, function(){
console.log('listening on *:3000');
});
Relevant Client Code:
<body>
<script src="/socket.io/socket.io.js"></script>
<h3 id="#player"></h3>
<canvas id="canvas" width="750" height="500"></canvas>
<script>var socket = io();
Run as is, I get:
GET http://staging.dustinraimondi.com/socket.io/socket.io.js
(index):8 Uncaught ReferenceError: io is not defined
If I change the socket.io script tag to the latest socket.io CDN I get : socket.io-1.4.5.js:1 GET http://staging.dustinraimondi.com/socket.io/?EIO=3&transport=polling&t=LR3DCHp 404 (Not Found)
If I change io();
to io.connect(23.239.8.165:3000);
as per Socket.IO only works locally io is still undefined and the 'GET' fails. Same if I use 'io.connect();', same if I specify my server's IP and I use the socket.io CDN.
What web concept am I not understanding here?
EDIT: Socket.io is installed on the server via NPM, the server is running.