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
548 stars 112 forks source link

Serving static files / obeying the Same Origin policy for websockets #2

Closed nickretallack closed 11 years ago

nickretallack commented 12 years ago

The instructions in the readme are very vague.

"run the server and brows to "/DemoHelloWorld.html"

On localhost? What port? I can just open the file DemoHelloWorld.html, but then it will be on a different origin from the websockets, causing it to print this:

14 Nov 23:57:57 - Initializing client with transport "websocket"
14 Nov 23:57:57 - WebSocket connection invalid or Origin not verified
14 Nov 23:58:02 - Initializing client with transport "xhr-polling"
14 Nov 23:58:02 - Client 03701277635991573 connected
1 joined the game!

If you want to use websockets, you have to be on the same origin, right? So you should have your server serve up this static file. And you should be clear about where your server is serving it to. It does not print out the client port to the terminal, and it took me a bit of hunting to find where that is even set.

onedayitwillmake commented 12 years ago

Those are valid points, the RealtmeMultiplayerNodeJS does not attempt to serve any files, i should note. I'll also make it spit out some more useful info when it starts such as the current port and address.

Thanks for the input

nickretallack commented 12 years ago

Is it even possible to test this system over the internet right now?

onedayitwillmake commented 11 years ago

This isn't really in the domain of this project, so closing issue for now