For deploying to a test server, see the README under ansible folder.
Client Server Setup
Index.js is the starting point of the app contains of the neccessary functions to run the application. Significant settings in this file are:
IP address and ports: the server will automatically bind to the ipv4 and ipv6 addresses of the host machine that it is deployed to (ie. app.listen(SERVERPORT,'::');). Addtionaly ports can be assigned with app.listen(ADDITIONALPORT);
Http Request: http configuration is defined to allow http posts and cross domain request.
WebSockets: websockets communication is defined
REST endpoints: rest endpoints are exposed to complete a speed test and include the following:
- testplan: testplan will return json data containing the ipv4, ipv6 ipaddresses and ports used for rest endPoints and websockets running on the server and the client ipAddress. Also additional speed test features(ie. latency based routing flags can be returned)
- latency: returns simple pong message
- download: binary data based on request
- upload: accepts post for uploads
- downloadProbe: returns recommended download bandwidth testing size based on request
- calculator: returns calculations based on request array giving statistics on datum.
- testServer: used in latency based routing.. it will return test servers urls that can be used to find the closet server to a client
Configuration: Generic configuration (ports, latencyBasedRouting,...) are set in index.js. Specific customization(ie. database) can be place under the config folder
- Configuration parameters
- Rest Endpoints
- Modules folder contains custom modules used for the application.
- Base xmlhttprequest and websocket objects
- Different test suites using the base Base xmlhttprequest and websocket objects
- test: test folder contains unit tests
- img: images for testing or ui
Grunt is being used to package the needed files and folders to deploy the application to a server to run the application. The steps are listed below:
- run grunt package from the root folder
- tar, zip or compress the resulting dist folder
- deploy and uncompress on your server
- execute node index.js from the console.
Running the application
To run the application locally
- Clone repo
- run npm install from root folder
- run node index.js
- browse to the ipaddress:port number (ie. locally it will be http://localhost:port
To set dynamodb locally
- Follow the instructions in the link to download and run dynamodb locally http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html
- Set up AWS credentially locally http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html
- Once dynamodb is set up locally. Use the following to script to create a table and insert the data into the dynamodb (execute node database.js from terminal)
- While executing the script change table name and server information