SpeedtestJS
Speed-testJS is a JavaScript based speed test that will provide users
with an enriched view of their Internet speed. Providing users with not
only their latency, upload and download speeds and context around their
entire Internet experience. Using speed tier data to add a qualifying
metric to standard speed test results users will now know whether their
experience is poor, good or great
Deployment
For deploying to a test server, see the README under ansible folder.
Client Server Setup
The application consists of a node/express software running the server and plain javascript/html on the client. The server
powers reset endpoints, websocket communication, database interactions and the client website.
Server
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
- WebSockets
- Modules folder contains custom modules used for the application.
Client
Client: Client application resides in the public folder and consists of plain javascript. Index.html is the
default start page of the application and will contain an end to end example of a Bandwidth Speed Test. The following describes
the folder structure of the client application:
- lib: The lib folder contains javascript files used to measure bandwidth and related measurements.
- example: The example folder contains html files used to test the measurement javascript files in the lib folder
- Base xmlhttprequest and websocket objects
- Different test suites using the base Base xmlhttprequest and websocket objects
- test: test folder contains unit tests
- uilib: javascript files specific to UI.
- img: images for testing or ui
Manual deployment
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
Database
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