A Javascript Library to check the network information and download speed of client. Using the principle of front end.
For the network information, it use IP-API for user network basic information and Google Maps to corroborate his data. And for the speed test, it use a fork of detectClientSpeed to allow progress checking.
The original files are NI.js who uses javascript classes. His successor was NI-allbrowsers.js, who was factorized and separated in three classes: Heimdal.js, NetworkInformation.js and SpeedTest.js.
- Heimdal
Main class who administrate the use of NetworkInformation & SpeedTest classes
- NetworkInformation
Class who get the information of the client network
- NetworkUtilities
Class with network utilities, as ping method. WARNING: This class is experimental, the methods contained here probably require a server.
- SpeedTest
Class in charge of make Speed Tests
Main class who administrate the use of NetworkInformation & SpeedTest classes
Kind: global class
- Heimdal
- new Heimdal(server)
- .init(callback) ⇒
undefined
- .runTest(on, file) ⇒
undefined
- .sendData() ⇒
undefined
- .pingTestSecuentialVersion(callback, earlycall) ⇒
undefined
- .pingTestConcurrentVersion(callback, earlycall) ⇒
undefined
- .getNetworkInfo() ⇒
NetworkInformation
- .getSpeedTests() ⇒
SpeedTest
- .getUtilities() ⇒
NetworkUtilities
- .addUserParam(varname, vardata) ⇒
undefined
Heimdal - Main class who administrate the use of NetworkInformation & SpeedTest classes
Param | Type | Description |
---|---|---|
server | string |
URL of the server where the JSON will be send |
init - Call to NetworkInformation to init his params and execute the callback function
Kind: static method of Heimdal
Param | Type | Description |
---|---|---|
callback | function |
function when the network information was ready |
runTest - Start the Speed test
Kind: static method of Heimdal
Param | Type | Description |
---|---|---|
on | function |
progress function. For loading stuff |
file | file |
used in the test |
sendData - Send all the data to the server
Kind: static method of Heimdal
pingTestSecuentialVersion - Start the ping test to top sites
Kind: static method of Heimdal
Param | Type | Description |
---|---|---|
callback | function |
The callback function when the ping test was ready. |
earlycall | function |
The function called when an individual ping test was ready. |
pingTestConcurrentVersion - Start the ping test to top sites
Kind: static method of Heimdal
Param | Type | Description |
---|---|---|
callback | function |
The callback function when the ping test was ready. |
earlycall | function |
The function called when an individual ping test was ready. |
Heimdal.getNetworkInfo() ⇒ NetworkInformation
getNetworkInfo - Return the NetworkInformation object
Kind: static method of Heimdal
Returns: NetworkInformation
- Inner NetworkInformation object
Heimdal.getSpeedTests() ⇒ SpeedTest
getSpeedTests - Return the SpeedTest object
Kind: static method of Heimdal
Returns: SpeedTest
- Inner SpeedTest object
Heimdal.getUtilities() ⇒ NetworkUtilities
getUtilities - Return the NetworkUtilities object
Kind: static method of Heimdal
Returns: NetworkUtilities
- Inner NetworkUtilities object
addUserParam - Add param to user data.
Kind: static method of Heimdal
Param | Type | Description |
---|---|---|
varname | string |
the name of the new var |
vardata | string |
the data of the new var |
Class who get the information of the client network
Kind: global class
- NetworkInformation
- new NetworkInformation()
- .getGoogleInfo(tail, callback, lat, lon) ⇒
undefined
- .setInformation(readyMethod) ⇒
undefined
- ~getHtml5Geolocation(tail_method, callbackfunction) ⇒
undefined
- ~getIpApiInformation(callbackfunction) ⇒
undefined
- ~getHtml5Geolocation(tail_method, callbackfunction) ⇒
- .getAS() ⇒
string
- .getCity() ⇒
string
- .getCountry() ⇒
string
- .getCountryCode() ⇒
string
- .getIsp() ⇒
string
- .getCoordinates() ⇒
Array
- .getOrganization() ⇒
string
- .useProxy() ⇒
boolean
- .getIp() ⇒
string
- .getRegion() ⇒
string
- .getRegionName() ⇒
string
- .getReverseDNS() ⇒
string
- .isSuccessful() ⇒
boolean
- .getTimezone() ⇒
string
- .isAndroid() ⇒
boolean
- .isMobile() ⇒
boolean
- .checkConnectionType() ⇒
string
- .getOS() ⇒
string
- .behindNAT() ⇒
boolean
NetworkInformation - Class who get the information of the client network
getGoogleInfo - receive the data from google and set in the internal vars
Kind: static method of NetworkInformation
Param | Type | Description |
---|---|---|
tail | function |
The tail function. |
callback | function |
The callback function. |
lat | number |
latitude |
lon | number |
longitude |
setInformation - Set all the information to the class. Requesting to the navigator, google and ip-api
Kind: static method of NetworkInformation
Param | Type | Description |
---|---|---|
readyMethod | function |
function called when the information was setted |
- .setInformation(readyMethod) ⇒
undefined
- ~getHtml5Geolocation(tail_method, callbackfunction) ⇒
undefined
- ~getIpApiInformation(callbackfunction) ⇒
undefined
- ~getHtml5Geolocation(tail_method, callbackfunction) ⇒
getHtml5Geolocation - get the geolocalitation from the navigator
Kind: inner method of this.setInformation
Param | Type | Description |
---|---|---|
tail_method | function |
next function to be called. |
callbackfunction | function |
callback function |
getIpApiInformation - get the network information from ip-api
Kind: inner method of this.setInformation
Param | Type | Description |
---|---|---|
callbackfunction | function |
callback function |
getAS - Get Autonomous system
Kind: static method of NetworkInformation
Returns: string
- Autonomous system
getCity - Get city
Kind: static method of NetworkInformation
Returns: string
- city
getCountry - Get country
Kind: static method of NetworkInformation
Returns: string
- country
getCountryCode - Get country code
Kind: static method of NetworkInformation
Returns: string
- country code
getIsp - Get the ISP
Kind: static method of NetworkInformation
Returns: string
- ISP
getCoordinates - Get Latlong of client.
Kind: static method of NetworkInformation
Returns: Array
- [Latitude, Longitude]
getOrganization - Get organization (or ISP if didn't exists)
Kind: static method of NetworkInformation
Returns: string
- organization
useProxy - Check if the user use a proxy
Kind: static method of NetworkInformation
Returns: boolean
- True if the user use a proxy
getIp - Get IP
Kind: static method of NetworkInformation
Returns: string
- IP
getRegion - Get region
Kind: static method of NetworkInformation
Returns: string
- Region
getRegionName - Get region's name
Kind: static method of NetworkInformation
Returns: string
- Region's name
getReverseDNS - Get the reverse of the DNS
Kind: static method of NetworkInformation
Returns: string
- Reverse of the DNS
isSuccessful - Check if the connection was successful
Kind: static method of NetworkInformation
Returns: boolean
- True if the connection was successful
getTimezone - Get timezone
Kind: static method of NetworkInformation
Returns: string
- Timezone
isAndroid - Check if the device is Android
Kind: static method of NetworkInformation
Returns: boolean
- True if the device is Android
isMobile - Check if the device is mobile
Kind: static method of NetworkInformation
Returns: boolean
- True if the device is mobile
checkConnectionType - If its avalaible, check the connection type. (Only work on Android)
Kind: static method of NetworkInformation
Returns: string
- Connection Type
getOS - Get the OS of the client
Kind: static method of NetworkInformation
Returns: string
- Operative System
behindNAT - Check if the client is behind NAT
Kind: static method of NetworkInformation
Returns: boolean
- True if the client is behind NAT
Class with network utilities, as ping method. WARNING: This class is experimental, the methods contained here probably require a server.
Kind: global class
- NetworkUtilities
- new NetworkUtilities()
- .ping(url, callback) ⇒
undefined
- .getPings() ⇒
Array
- .pingTopSecuentialVersion(earlycall, callback) ⇒
undefined
- .pingTopConcurrentVersion(earlycall, callback) ⇒
undefined
- .checkNAT(url, callback) ⇒
undefined
NetworkUtilities - Class with network utilities, as ping method. WARNING: This class is experimental, the methods contained here probably require a server.
ping - ping to a url. WARNING: THIS REQUIRED A SERVER TO CHECK IF A URL REALLY EXISTS. OTHERWISE THE PING SUCCESS WITH FALSE POSITIVE.
Kind: static method of NetworkUtilities
Param | Type | Description |
---|---|---|
url | string |
the url to be pinged |
callback | function |
Callback function when the specific ping as done. Receive a ping object with the time, the status and the url. |
getPings - Get an array with pings.
Kind: static method of NetworkUtilities
Returns: Array
- Pings
pingTestSecuentialVersion - Make a secuencial ping to TOP_CL urls
Kind: static method of NetworkUtilities
Param | Type | Description |
---|---|---|
earlycall | function |
The function called when an individual ping test was ready. |
callback | function |
The callback function when the process finish. |
pingTestConcurrentVersion - Make a concurrent ping to TOP_CL urls
Kind: static method of NetworkUtilities
Param | Type | Description |
---|---|---|
earlycall | function |
The function called when an individual ping test was ready. |
callback | function |
The callback function when the process finish. |
checkNAT - Send a request to a specific server to check if the client is behind NAT. With callback function.
Kind: static method of NetworkUtilities
Param | Type | Description |
---|---|---|
url | string |
The url of the server. |
callback | function |
The callback function. Receive server answer as param. |
Class in charge of make Speed Tests
Kind: global class
- SpeedTest
- new SpeedTest(file_url)
- .getDownloadSpeed() ⇒
number
- .getLatency() ⇒
number
- .getLatencyType() ⇒
string
- .getThroughput() ⇒
number
- .getThroughputType() ⇒
string
- .getTestTime() ⇒
number
- .startSpeedTest(onprogress) ⇒
undefined
SpeedTest - Class in charge of make Speed Tests
Param | Type | Description |
---|---|---|
file_url | string |
URL of the file used in the download speed test |
getDownloadSpeed - Get the download speed
Kind: static method of SpeedTest
Returns: number
- download speed
getLatency - Get the latency
Kind: static method of SpeedTest
Returns: number
- latency
getLatencyType - Get the equivalence of latency
Kind: static method of SpeedTest
Returns: string
- Latency speed class name
getThroughput - Get the throughput
Kind: static method of SpeedTest
Returns: number
- throughput
getThroughputType - Get the equivalenceof throughput
Kind: static method of SpeedTest
Returns: string
- Throughput speed class name
getTestTime - Get the total time of the test
Kind: static method of SpeedTest
Returns: number
- duration of test
startSpeedTest - start the speed test
Kind: static method of SpeedTest
Param | Type | Description |
---|---|---|
onprogress | function |
on progress function |