Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
borderColor#3D3D3D
bgColor#F4F4F4
titleColor#3D3D3D
borderWidth0
titleBGColor#3D3D3D
borderStylesolid

ON THIS PAGE

Table of Contents
indent20px

The networkdiagnostics object allows you to retrieve information about network interfaces and Internet connectivity.

Code Block
languagejs
titlenetworkdiagnostics IDL
collapsetrue
interface NetworkDiagnostics {
    Promise<NetworkDiagnosticsResult> testInternetConnectivity()
    Promise<NetworkDiagnotsticsResult> testNetworkInterface(String interface_name)
    Promise<PingResult> ping(String host_name, PingConfig config)
    //< For BrightSign internal use. Behaviour subject to change without notice.
    Promise<TracerouteResult> traceroute(String host_name, TracerouteConfig config)
    //< For BrightSign internal use. Behaviour subject to change without notice.
};

interface InterfaceTestResult {
    String diagnosis;
    bool    ok;
    Array<Log> log;
};

interface Log {
    String name;
    bool pass;
    String result;
    Array<String> info;
    //< For BrightSign internal use. Behaviour subject to change without notice.
};

Object Creation

To create a networkdiagnostics object, first load the brightsign/networkdiagnostics module using the require() method. Then create an instance of the networkdiagnostics class.

Code Block
languagejs
var NetworkDiagnosticsClass = require("@brightsign/networkdiagnostics");
var networkDiag = new NetworkDiagnosticsClass();

NetworkDiagnostics

Use this interface to retrieve diagnostic information.

Warning
titleImportant

The testInternetConnectivity() method generates a large amount of network traffic (e.g. DNS lookups) that may degrade the performance of a player, create network congestion, or be perceived as abusive by the network's upstream DNS provider. This method is intended for one-time use to validate network connectivity or to diagnose a suspected problem. 

testInternetConnectivity()
Code Block
languagejs
Promise<InterfaceTestResult> testInternetConnectivity()

Performs various tests on the Internet connection (via any available network interface) to determine whether it appears to be working correctly. This method returns an InterfaceTestResult interface when diagnostics are complete.

testNetworkInterface()
Code Block
languagejs
Promise<InterfaceTestResult> testNetworkInterface(String interface_name)

Performs tests on the specified network interface to determine whether it appears to be working correctly. Interface name values are the same as those used with the roNetworkConfiguration object. This method returns an InterfaceTestResult interface when diagnostics are complete.

ping()
Code Block
languagejs
Promise<PingResult> ping(String host_name, PingConfig config)

Pings a device with the specified host_name to determine if there are connection issues. 

InterfaceTestResult

This interface contains diagnostic results:

  • [String] diagnosis: A single-line diagnosis of the first problem identified with the network interface or Internet connection
  • [bool] ok: A Boolean flag indicating whether the network interface or Internet connection passed diagnostic tests
  • [Log] log: A Log object containing diagnostic information related to the network interface or Internet connection

Log

This interface contains a list of diagnostic logs. Each log contains the following attributes:

  • [String] name: A description of the diagnostic 
  • [bool] pass: A Boolean flag indicating whether the diagnostic was successful
  • [String] result: A description of the diagnostic result
  • [StringList] info: A string list containing diagnostic data

Example

The following script creates a networkdiagnostics instance and logs Internet diagnostic data to the console:

Code Block
languagejs
var NetworkDiagnosticsClass = require("@brightsign/networkdiagnostics");
var nd = new NetworkDiagnosticsClass();
nd.testInternetConnectivity().then(
        function(data) {
            console.log(JSON.stringify(data));
        })
    .catch(
        function(data) {
            console.log(JSON.stringify(data));
        });