You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

WiFiMon uses JavaScript in frequently-visited websites to trigger the tests. In Section 1, we provide the instructions to embed the scripts in your website downloading Images and scripts from our Apache Server, i.e. fl-5-205.unil.cloud.switch.ch that is located in Lausanne, Switzerland.

Notably, measurement results, i.e. Download/Upload Rates and Round Trip Times (RTTs) are relative to the WiFiMon Test Server. In case of the Apache Server located in Lausanne, results are relative to this server. For more accurate results, you may setup your own Apache Server to host the images and scripts that enabled the performance test from your server. The instructions to achieve that are presented in Section 2.

1. Embed Scripts in your Website

WiFiMon is currently using 3 different JavaScript-based test tools to measure the performance of WiFi networks: NetTest, boomerang and speedtest/HTML5. The following paragraphs show the lines that should be included in the HTML code of these websites for each test tool.

1.1. NetTest

Triggering NetTest measurements requires embedding the following lines of code in your website:

<script type="text/javascript" src="https://fl-5-205.unil.cloud.switch.ch/wifimon/js/nettest/jquery-3.5.1.min.js"> </script>
<script type="text/javascript" src="https://fl-5-205.unil.cloud.switch.ch/wifimon/js/nettest/nettest-swfobject.js"> </script>
<script type="text/javascript" src="https://www.google.com/jsapi"> </script>
<script type="text/javascript" id="settings" agentIp="xxx.xxx.xxx.xxx" testtool="NetTest"
                           imagesLocation="https://fl-5-205.unil.cloud.switch.ch/wifimon/images/" cookieTimeInMinutes=""
                           src="https://fl-5-205.unil.cloud.switch.ch/wifimon/js/nettest/runtests.js" defer></script>

  •  agentIP (required): Replace "xxx.xxx.xxx.xxx" with the IP address (or domain name) of the WiFiMon Analysis Server.

  • imagesLocation (required): Public link to the folder where the images are downloaded to perform the NetTest measurements.

  • testtool (required): With this attribute, you specify a name for the testtool. WiFiMon Analysis Server relies on the value of this attribute to visualize measurements received from WiFiMon Hardware Probes. Thus, if number x is assigned to a WiFiMon Hardware Probe, you should specify the value of this attribute as "NetTest-x".

  • cookieTimeInMinutes (optional): Duration time (in minutes) to set the cookie in order to prevent repeated measurements and overload the WiFiMon Analysis Server. If empty, "1.5" is assumed, i.e. 90 seconds.

  • If your website already included the jquery.min.js, you have to delete the first line.

  • With the above JavaScript lines, the images (that NetTest is using) and scripts are downloaded from the WiFiMon Test Server located in Lausanne, Switzerland. For more accurate results you can setup your own Apache Server to host the images and scripts. Detailed instructions are provided in paragraph 2.

  • If the above scripts are embedded only to HTTP websites, the attribute hostingWebsite="http" should be added at the last script after the id attribute. This will direct the measurements to the Non-Secure WiFiMon Agent running on port 9000.

1.2. boomerang

Triggering boomerang measurements requires embedding the following lines of code in your website:

<script type="text/javascript" src="https://fl-5-205.unil.cloud.switch.ch/wifimon/js/boomerang/jquery-3.5.1.min.js"> </script>
<script type="text/javascript" src="https://www.google.com/jsapi"> </script>
<script type="text/javascript" src="https://fl-5-205.unil.cloud.switch.ch/wifimon/js/boomerang/boomerang.js"> </script>
<script type="text/javascript" src="https://fl-5-205.unil.cloud.switch.ch/wifimon/js/boomerang/bw.js"> </script>
<script type="text/javascript" src="https://fl-5-205.unil.cloud.switch.ch/wifimon/js/boomerang/rt.js"> </script>
<script type="text/javascript" id="settings" agentIp="xxx.xxx.xxx.xxx" testtool="boomerang"
                           imagesLocation="https://fl-5-205.unil.cloud.switch.ch/wifimon/images/" cookieTimeInMinutes="" 
                           src="https://fl-5-205.unil.cloud.switch.ch/wifimon/js/boomerang/boomerang-trigger.js" defer></script>

  •  agentIP (required): Replace "xxx.xxx.xxx.xxx" with the IP address (or domain name) of the WiFiMon Analysis Server.

  • imagesLocation (required): Public link to the folder where the images are downloaded to perform the boomerang measurements.

  • testtool (required): With this attribute, you specify a name for the testtool. WiFiMon Analysis Server relies on the value of this attribute to visualize measurements received from WiFiMon Hardware Probes. Thus, if number x is assigned to a WiFiMon Hardware Probe, you should specify the value of this attribute as "boomerang-x".

  • cookieTimeInMinutes (optional): Duration time (in minutes) to set the cookie in order to prevent repeated measurements and overload the WiFiMon Analysis Server. If empty, "1.5" is assumed, i.e. 90 seconds.

  • If your website already included the jquery.min.js, you have to delete the first line.

  • With the above JavaScript lines, the images (that boomerang is using) and scripts are downloaded from the WiFiMon Test Server located in Lausanne, Switzerland. For more accurate results you can setup your own Apache Server to host the images and scripts. Detailed instructions are provided in paragraph 2.

  • If the above scripts are embedded only to HTTP websites, the attribute hostingWebsite="http" should be added at the last script after the id attribute. This will direct the measurements to the Non-Secure WiFiMon Agent running on port 9000.

1.3. Speedtest/HTML5

Step 1: Create the following proxy HTML page:

<!DOCTYPE html>
<html>
<head>
<title>Speed worker</title>
<script type="text/javascript" src="https://fl-5-205.unil.cloud.switch.ch/wifimon/js/speedtest/jquery-3.5.1.min.js"> </script>
<script type="text/javascript" src="https://www.google.com/jsapi"> </script>
<script type="text/javascript" id="settings" agentIp="xxx.xxx.xxx.xxx" testtool="speedtest" cookieTimeInMinutes="" src="https://fl-5-205.unil.cloud.switch.ch/wifimon/js/speedtest/speedworker-post.js"> </script>
</head>
<body>
</body>
</html>

Step 2: Embed the proxy HTML page in your website pages:

<iframe src="https://fl-5-205.unil.cloud.switch.ch/wifimon/js/speedtest/speedworker.html" style="visibility: hidden;"></iframe>

  • agentIP (required): Replace "xxx.xxx.xxx.xxx" with the IP address (or domain name) of the WiFiMon Analysis Server.

  • testtool (required): With this attribute, you specify a name for the testtool. WiFiMon Analysis Server relies on the value of this attribute to visualize measurements received from WiFiMon Hardware Probes. Thus, if number x is assigned to a WiFiMon Hardware Probe, you should specify the value of this attribute as "speedtest-x".

  • cookieTimeInMinutes (optional): Duration time (in minutes) to set the cookie in order to prevent repeated measurements and overload the WiFiMon Analysis Server. If empty, "1.5" is assumed, i.e. 90 seconds.

  • If your website already included the jquery.min.js, you have to delete the first line.

  • With the above JavaScript lines, the images (that boomerang is using) and scripts are downloaded from the WiFiMon Test Server located in Lausanne, Switzerland. For more accurate results you can setup your own Apache Server to host the images and scripts. Detailed instructions are provided in paragraph 2.

  • If the above scripts are embedded only to HTTP websites, the attribute hostingWebsite="http" should be added at the last script after the id attribute. This will direct the measurements to the Non-Secure WiFiMon Agent running on port 9000.

2. Download Test Images from your Server

With the JavaScript lines of the previous section, the images and scripts are downloaded from our WiFiMon Test Server, i.e. fl-5-205.unil.cloud.switch.ch, that is located in Lausanne, Switzerland. Therefore, the performance results will be relative to this server.

2.1. NetTest

For more accurate results with NetTest you may setup your WiFiMon Test Server, i.e. Apache Server to host the images and scripts, by following the steps below:

  • Step 1: Install Apache2 with PHP 7.3. We suggest that you install PHP 7.3. This is the default PHP version of Debian 10:

              sudo apt-get update

              sudo apt-get install -y apache2
              sudo apt-get install -y php php-common
              sudo apt-get install -y libapache2-mod-php7.3
              sudo /etc/init.d/apache2 restart


  • Step 2: Enable Apache2 mod_headers:

              a2enmod headers

              sudo service apache2 restart


  • Step 3: Enable CORS. Add the following lines in the /etc/apache2/apache2.conf file and restart Apache2:

<Files ~ "\.(htm|html|css|dat|js|php|gif|jpg|png|swf)$">

Header always set Access-Control-Allow-Origin "*"

Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"

Header always set Access-Control-Max-Age "1000"

Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"

</Files>

  • Step 4: Scripts and Images: Download a .zip file with the images and scripts for NetTest from HERE, or the .zip file containing the necessary files for all the available tests (NetTest, boomerang, speedtest/HTML5) from HERE. Unzip the content inside the root directory of Apache2 and make the following changes:(i) wifimon/js/nettest/nettest-swfobject.js: Change the NetTest.FlashPath with the public link to nettest.swf.
    (ii) Embed in your website the scripts provided, after specifying the new URL in their src attribute and imagesLocation attribute (see Section 1).

2.2. boomerang

For more accurate results with boomerang you may setup your WiFiMon Test Server, i.e. Apache Server to host the images and scripts, by following the steps below:

  • Step 1: Install Apache2 with PHP 7.3. We suggest that you install PHP 7.3. This is the default PHP version of Debian 10:

              sudo apt-get update
              sudo apt-get install -y apache2
              sudo apt-get install -y php php-common
              sudo apt-get install -y libapache2-mod-php7.3
              sudo /etc/init.d/apache2 restart

  • Step 2: Enable Apache2 mod_headers:

              a2enmod headers
              sudo service apache2 restart

  • Step 3: Enable CORS. Add the following lines in the /etc/apache2/apache2.conf file and restart Apache2:

<Files ~ "\.(htm|html|css|dat|js|php|gif|jpg|png|swf)$">

Header always set Access-Control-Allow-Origin "*"

Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"

Header always set Access-Control-Max-Age "1000"

Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"

</Files>

  • Step 4: Scripts and Images: Download a .zip file with the images and scripts for boomerang from HERE, or the .zip file containing the necessary files for all the available tests (NetTest, boomerang, speedtest/HTML5) from HERE. Unzip the content inside the root directory of Apache2 and make the following change: Embed in your website the scripts provided, after specifying the new URL in their src attribute and imagesLocation attribute (see Section 1).

2.3. Speedtest/HTML5

For more accurate results with Speedtest/HTML5 you may setup your WiFiMon Test Server, i.e. Apache Server to host the images and scripts, by following the steps below:

  • Step 1: Install Apache2 with PHP 7.3. We suggest that you install PHP 7.3. This is the default PHP version of Debian 10:

               sudo apt-get update

              sudo apt-get install -y apache2
              sudo apt-get install -y php php-common
              sudo apt-get install -y libapache2-mod-php7.3
              sudo /etc/init.d/apache2 restart


  • Step 2: Enable Apache2 mod_headers:

              a2enmod headers

              sudo service apache2 restart


  • Step 3: Enable CORS. Add the following lines in the /etc/apache2/apache2.conf file and restart Apache2:

<Files ~ "\.(htm|html|css|dat|js|php|gif|jpg|png|swf)$">

Header always set Access-Control-Allow-Origin "*"

Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"

Header always set Access-Control-Max-Age "1000"

Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"

</Files>

  • Step 4: Scripts and Images: Download a .zip file with the images and scripts for speedtest from HERE, or the .zip file containing the necessary files for all the available tests (NetTest, boomerang, speedtest/HTML5) from HERE. Unzip the content inside the root directory of Apache2 and make the following change: If you have not created a proxy HTML page, you may use proxy.html (included in folder wifimon/js/speedtest) as the proxy HTML page. If this is the case, you will have to replace "xxx.xxx.xxx.xxx" in the agentIP attribute, with the IP address (or domain name) of the server where the WiFiMon Analysis Server is installed. In every case, you will also have to specify the new URLs for the scripts by changing their src attribute.

3. Combining Measurements in the Same Page

In case you want to include all three types of testtools (NetTest, boomerang, speedtest/HTML) in the same page, inject the following HTML lines in the "head" section of your website:

<iframe src="https://fl-5-205.unil.cloud.switch.ch/wifimon/measurements/nettest.html" style="visibility: hidden;"></iframe>
<iframe src="https://fl-5-205.unil.cloud.switch.ch/wifimon/js/speedtest/speedworker.html" style="visibility: hidden;"></iframe>
<iframe src="https://fl-5-205.unil.cloud.switch.ch/wifimon/measurements/boomerang.html" style="visibility: hidden;"></iframe>

where nettest.html, speedworker.html, boomerang.html include the Javascript lines that trigger the necessary tests.


  • No labels