onedayitwillmake / RealtimeMultiplayerNodeJs

Realtime Mutliplayer Game Engine using Node.js / websockets for HTML5 that uses a client-server approach in which the clients send only sampled input to the server
549 stars 112 forks source link

Demo fails to produce any output (Mac 10.7) #1

Closed johndevor closed 13 years ago

johndevor commented 13 years ago

I'm trying to follow the simple 3-step instructions, but I'm running into some trouble.

The server starts and outputs the normal message:

$ node js/DemoCircles/server.js
29 Jul 00:31:22 - Your node instance does not have root privileges. This means that the flash XML policy file will be served inline instead of on port 843. This will slow down initial connections slightly.
29 Jul 00:31:22 - socket.io ready - accepting connections

But when I try to load the demo (in Safari or Chrome), nothing happens. The browser appears to connect (as the loading spinner runs until I ctrl-c the server), but no more console output appears, and nothing appears in the browser(s).

I've tried connecting to a variety of URLs (I'm assuming the default port of 8081 is correct):

http://localhost:8081/RealtimeMultiplayerNodejs/DemoCircles.html
http://localhost:8081/DemoCircles.html

Any help? Am I missing any dependencies?

onedayitwillmake commented 13 years ago

Do you have any console.log output from the browser?

johndevor commented 13 years ago

Nothing. Just looks like this.

I believe I am on the correct port and the correct URL, but the server isn't talking. Here's a picture of terminal.

hikirsch commented 13 years ago

I know that if you don't run node as a root user and you're trying to use Socket.io it wont have the permissions to open the port.

does running sudo node ... help ?

--Adam

onedayitwillmake commented 13 years ago

Chrome 13 uses the new handshake authorization for websockets "hybi-10" - that might have something to do with it as well, as I don't think Socket.io has upgraded yet... but i think they're working on it?

johndevor commented 13 years ago

Still no luck.

$ sudo node js/DemoCircles/server.js
Password:
10 Aug 17:39:48 - socket.io ready - accepting connections

But still neither Safari nor Chrome can connect to it... they both just spin.

No data received
Unable to load the webpage because the server sent no data.
Here are some suggestions:
Reload this webpage later.
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
hikirsch commented 13 years ago

This is very odd. I just tried in on my OS X Lion with node v0.4.7 (a little outdated but I dont think this should matter so much). You should be able to load the HTML page without node starting so something seems odd to me that you aren't able to show the base HTML. Does the page load if you do not run node? Also what version of node are you using and how did you build it?

johndevor commented 13 years ago

Ok, I got it to work. Though I had to put it in my Sites folder and navigate to this address:

http://192.168.1.105/~john/RealtimeMultiplayerNodejs/DemoCircles.html

Any idea how to avoid having to have it in the sites folder?

onedayitwillmake commented 13 years ago

In order to access the demo, it needs to be running from a webserver. This is why putting it in your 'Sites' folder works, because now your browser can reach those pages.

Looking at it now, i notice you tried to reach localhost:8081 - I hadn't noticed it before. That won't work, because node.js is not going to serve the files to you.

Try using MAMP - it's free and pretty powerful

johndevor commented 13 years ago

Ah great. Still getting used to Node / javascript... I'm too used to python / django / apache!

Thanks for the help!