RealtimeMultiplayerNodeJs icon indicating copy to clipboard operation
RealtimeMultiplayerNodeJs copied to clipboard

How to run the demo?

Open jeena opened this issue 13 years ago • 6 comments

Hi,

how are you supposed to start the demo? The documentation just says: 'Browse to "/DemoHelloWorld.html"' but on which server or port or just with file://? I tried

http://localhost/path/to/DemoHelloWorld.html (via my local Apache) file:///path/to//DemoHelloWorld.html http://example.com/path/to//DemoHelloWorld.html (Apache on the internet) http://localhost:8081/DemoHelloWorld.html (Port from js/model/Constants.js) http://example.com:8081/DemoHelloWorld.html (Port from js/model/Constants.js)

The description suggests that this would be perfect for what we try to do (a multiplayer server/client game with node in the browser) but it seems not to matter what I try to get the demo up and running (I even tried it as root as one other guy suggested), either nothing happens or I get the error:

Lala:game jeena$ sudo node js/DemoHelloWorld/server.js
Password:
7 Jun 13:59:08 - socket.io ready - accepting connections
7 Jun 13:59:29 - Initializing client with transport "websocket"
7 Jun 13:59:29 - WebSocket connection invalid or Origin not verified
7 Jun 13:59:34 - Initializing client with transport "xhr-polling"

/Users/jeena/game/js/lib/Socket.IO-node/lib/socket.io/transports/xhr-polling.js:119
    res.setHeader('Content-Type', 'text/plain; charset=UTF-8');
        ^
TypeError: Object #<a ServerResponse> has no method 'setHeader'
    at Polling._write (/Users/jeena/game/js/lib/Socket.IO-node/lib/socket.io/transports/xhr-polling.js:119:9)
    at Polling._payload (/Users/jeena/game/js/lib/Socket.IO-node/lib/socket.io/client.js:167:28)
    at Polling._onConnect (/Users/jeena/game/js/lib/Socket.IO-node/lib/socket.io/transports/xhr-polling.js:59:12)
    at Polling.Client (/Users/jeena/game/js/lib/Socket.IO-node/lib/socket.io/client.js:49:8)
    at new Polling (/Users/jeena/game/js/lib/Socket.IO-node/lib/socket.io/transports/xhr-polling.js:24:10)
    at Listener._onConnection (/Users/jeena/game/js/lib/Socket.IO-node/lib/socket.io/listener.js:223:66)
    at Listener.check (/Users/jeena/game/js/lib/Socket.IO-node/lib/socket.io/listener.js:142:12)
    at Server.<anonymous> (/Users/jeena/game/js/lib/Socket.IO-node/lib/socket.io/listener.js:68:14)
    at Server.emit (events:27:15)
    at HTTPParser.onIncoming (http:83Lala:game jeena$ sudo node js/DemoHelloWorld/server.js

jeena avatar Jun 07 '12 12:06 jeena

The same is happening for me.

logsol avatar Jun 07 '12 12:06 logsol

Hi - this weekend I will update node, and Socket.io and make sure everything is running as expected - I believe that since node advances at such a fast pace, and so does socket.io - i'm calling some function in some way that is now deprecated.

It should not be a problem, and I will look into it this weekend. To answer your question directly - you have to serve the files yourself ( i usually just use mamp ) - then open that file such as "http://localhost/path/to//DemoHelloWorld.html" - which you are doing already so i suspect its a deprecated function isse

onedayitwillmake avatar Jun 07 '12 17:06 onedayitwillmake

any update on this update? Curious to play with this but not sure how to get it started.

MDrollette avatar Jun 22 '12 22:06 MDrollette

I'm interested in playing with this, but am also having a problem starting the demo. I suspect it's because I'm using node v0.11.3? (and the master branch is only compatible with v0.9, right?)

jacobperron avatar Jul 03 '13 17:07 jacobperron

This issue is two years old... but i've updated the repo so that you should be able to run the demos out of the box.

If you still want to see it work, can you try the steps in the README to see if the demos work for you now?

  1. Download this repo
  2. In the terminal, navigate to the root directory of the repo
  3. Run "npm install"
  4. Run "node js/DemoBox2D/server.js"
  5. Within another terminal, navigate to the root directory and run "python -m SimpleHTTPServer"
  6. From the browser, open "http://127.0.0.1:8000/DemoBox2DApp.html"

brendonjohn avatar Mar 23 '14 22:03 brendonjohn

worked for me :+1:

fyyyyy avatar Jul 26 '15 16:07 fyyyyy