Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing and running browserquest on ubuntu

I have installed node.js and necessary packages to run browserquest. I have started the browserquest server, which is running on port 8080 and when I go to my browser and type http://localhost:8080/status I can see that server is running and currently no clients are connected. I build the client with configurations like this in client/config/build_config.json file

{
   "host": "http://127.0.0.1",
   "port": 8080
}

I build my client within bin/build.sh. Then I run this command to create http-server to serve client files.

http-server path-to-client-build -p 8000

I can see the index page with the httpserver running by going to http://localhost:8000/index.html but when I try to connect it gets stuck after saying connecting to server.

NOTE: I am using this http-server to host client files http://search.npmjs.org/#/http-server

like image 861
Ersel Aker Avatar asked Apr 19 '12 22:04

Ersel Aker


1 Answers

I think the client-build has some problems on the current release on github. Instead I have used the actual client folder. I have followed these steps to make it work.

Make sure you have installed node and npm.

1) get a copy from github repo.

git clone https://github.com/mozilla/BrowserQuest.git

2) Install the required node packages for the server

npm install underscore log bison websocket websocket-server sanitizer memcache

3) Start the server

node server/js/main.js

4) go to the client directory and install http-server module to serve the client files

cd client
npm install -g http-server

5) edit config_build.json-dist to point to your host ip and port (in my case 127.0.0.1 localhost)

{
"host": "127.0.0.1",
"port": 8000,
"dispatcher": false
}

6) copy the edited config_build.json-dist to 2 new files

cp config_build.json-dist config_build.json
cp config_build.json-dist config_local.json

7) copy shared folder into client folder

cp -r ../shared .

8) start the http-server to serve the client files

http-server

And your server and client should be running. You can check if the server is running by going to http://ipaddress:port/status which should display an array of connected clients. If none an empty array. And your client should be running on http://ipaddress:8000/index.html

based on the tutorial from dirkk0 https://gist.github.com/2275361

like image 199
Ersel Aker Avatar answered Oct 05 '22 23:10

Ersel Aker