Setup for Test Project
Node.js and Socket.IO must be available locally, or you need to have an external instance of node to work with. I’ll assume for the moment you’ll want to work locally, so here are the simple steps:
- Download and install nodejs from here:
All of my testing as been with latest versions – currently at v0.6.10
- Run the “install_node_modules.bat” batch file from the ..\TestProject\Node folder
This will install 3 of the required modules for my tests in the sub-folder ..\TestProject\Node\node_modules :
- optimist - Light-weight option parsing for node
- express - High performance, high class web development for node
- socket.io – Realtime websocket server for node
- A local version of node.js and associated modules are now ready to go.
..\TestProject\node\startEvents.bat can be used to start the node.js instance, and launch chrome browser to a default web page. Changes any of the following items as you might require.
start "node cmd" /B node appEvents.js --host %host% --port %port%
start "chrome" chrome.exe http://%host%:%port%/
Running the batch file should result in a console window for node.js opening like:
The batch file will also open a chrome browser page with a sample web page:
I have not include the node_modules directory that contains modules. npm (node package manager) makes getting &installing any modules extremely easy, and hopefully eliminate any versioning and documentation issues - not to mention any licensing
issues that might get (ahem) stepped on.