Node JS and VPS issue
Posted: Sat Jun 08, 2013 1:52 am
So this post follows up from my previous question about setting up a small multiplayer HTML5 game (http://indie-resource.com/forums/viewto ... =65&t=6768) following this tutorial (http://www.youtube.com/watch?v=2_e5NaDX2rs)
the problem is that these tutorials only teaches you how to create a game on localhost but I want to take it online through my website so that it becomes sort of a small online multiplayer game.
So far I have setup a VPS on dreamhost and installed Node JS on the server through SSH using putty. It seems that I can get the node (app.js) started without a problem on my VPS but the game can't seem to load on the website since I guess it has an issue with connecting with socket.io or reaching it.
On my local machine there's an index.html file that contains the line
"<script src="http://localhost:8080/socket.io/socket.io.js"></script>"
which I guess communicates with the server
then I simply run the bat file which starts app.js then everything works fine
So I changed the index file line on my website server to
"<script src="http://mywebsite.com/tutorial/socket.io ... "></script>"
but still no luck
There could be some other reason why but I think it has something to do with that line.
this is how I start the node app.js on putty
[server] $ node /home/server/mywebsite.com/tutorial/app.js
output:
info - socket.io started
warn - error raised: Error: listen EADDRINUSE
Java script console output when I try running the game off my website
Uncaught ReferenceError: require is not defined socket.io.js:12
Uncaught ReferenceError: io is not defined (mywebsite).com/:36
Uncaught TypeError: Cannot call method 'emit' of undefined
the problem is that these tutorials only teaches you how to create a game on localhost but I want to take it online through my website so that it becomes sort of a small online multiplayer game.
So far I have setup a VPS on dreamhost and installed Node JS on the server through SSH using putty. It seems that I can get the node (app.js) started without a problem on my VPS but the game can't seem to load on the website since I guess it has an issue with connecting with socket.io or reaching it.
On my local machine there's an index.html file that contains the line
"<script src="http://localhost:8080/socket.io/socket.io.js"></script>"
which I guess communicates with the server
then I simply run the bat file which starts app.js then everything works fine
So I changed the index file line on my website server to
"<script src="http://mywebsite.com/tutorial/socket.io ... "></script>"
but still no luck
There could be some other reason why but I think it has something to do with that line.
this is how I start the node app.js on putty
[server] $ node /home/server/mywebsite.com/tutorial/app.js
output:
info - socket.io started
warn - error raised: Error: listen EADDRINUSE
Java script console output when I try running the game off my website
Uncaught ReferenceError: require is not defined socket.io.js:12
Uncaught ReferenceError: io is not defined (mywebsite).com/:36
Uncaught TypeError: Cannot call method 'emit' of undefined