Page tree
Skip to end of metadata
Go to start of metadata

ON THIS PAGE

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

networkdiagnostics IDL
[
    GarbageCollected
] interface NetworkDiagnostics {
    Promise <InterfaceTestResult> testInternetConnectivity();
    Promise <InterfaceTestResult> testNetworkInterface(DOMString interface_name);
};

interface InterfaceTestResult {
    DOMString diagnosis;
    bool    ok;
    LogList log;
};

interface Log {
    DOMString name;
    DOMString pass;
    DOMString result;
    DOMStringList info;
};

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.

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

NetworkDiagnostics

Use this interface to retrieve diagnostic information.

testInternetConnectivity()
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()
Promise <InterfaceTestResult> testNetworkInterface(DOMString 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.

InterfaceTestResult

This interface contains diagnostic results:

  • [bool] ok: A Boolean flag indicating whether the network interface or Internet connection passed diagnostic tests
  • [DOMString] diagnosis: A single-line diagnosis of the first problem identified with the network interface or Internet connection
  • [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:

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

Example

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

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));
        });
  • No labels