Player APIs (BrightScript & Ja...
JavaScript APIs

networkdiagnostics

15min
the networkdiagnostics object allows you to retrieve information about network interfaces and internet connectivity networkdiagnostics idl interface networkdiagnostics { promise\<networkdiagnosticsresult> testinternetconnectivity() promise\<networkdiagnotsticsresult> testnetworkinterface(string interface name) promise\<pingresult> ping(string host name, pingconfig config) 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 }; interface pingconfig { unsigned? short count; // default 10 unsigned long? interval; // in milliseconds, default 100 unsigned long? timeout; // in seconds, default 10000 unsigned long? packetsize; // in bytes, default 56 bool? ipv4; // enable pinging ipv4 addresses, default true bool? ipv6; // enable pinging ipv6 addresses, default false bool? alladdresses; // if true then ping all addresses returned from dns query, // if false then each will be pinged in turn until one responds, default false }; interface pingresult { string hostname; // host name or literal address pinged pingresults results; }; interface pingresults { bool up; // true if at least one address responded to at least 50% of the echo requests array\<protocolpingresult>? ipv4; array\<protocolpingresult>? ipv6; }; interface protocolpingresult { string address; // ip address pinged bool up; // true if the address responded to at least 50% of the echo requests protocolpingreport report; }; interface protocolpingreport { unsigned short transmitted; // number of echo requests sent unsigned short received; // number of echo replies received protocolpingstats stats; }; interface protocolpingstats { unsigned long quickest; // quickest reply received unsigned long average; // average time across all replies from address unsigned long slowest; // slowest reply received string units; // always "us" to indicate microseconds }; 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 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() 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(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 docid\ u6zceyqddlz9xdakttmjs object this method returns an interfacetestresult interface when diagnostics are complete ping() promise\<pingresult> ping(string host name, pingconfig config) pings a device with the specified host name to determine if there are connection issues traceroute() promise\<interfacetestresult> traceroute(string host name, tracerouteconfig config) for brightsign internal use behavior subject to change without notice performs a standard traceroute diagnostic on the specified host name interfacetestresult this interface contains diagnostic results diagnosis string string a single line diagnosis of the first problem identified with the network interface or internet connection ok bool bool whether the network interface or internet connection passed diagnostic tests log 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 name string string a description of the diagnostic pass bool bool whether the diagnostic was successful result string string a description of the diagnostic result info stringlist stringlist a string list containing diagnostic data pingconfig this interface is not recommended unless you are using brightsign os v8 3 45 and later count unsigned short unsigned short the default value is 10 interval unsigned long unsigned long the interval value in milliseconds the default is 100 timeout unsigned long unsigned long the timeout value in seconds the default is 10000 packetsize unsigned long unsigned long the packet size in bytes the default is 56 ipv4 bool bool enable pinging ipv4 addresses the default is true ipv6 bool bool enable pinging ipv6 addresses the default is true alladdresses bool bool if true then ping all addresses returned from the dns query if false , then each will be pinged in turn until one responds the default is false pingresult this interface is not recommended unless you are using brightsign os v8 3 45 and later hostname string string the host name or literal address pinged results pingresults pingresults pingresults this interface is not recommended unless you are using brightsign os v8 3 45 and later up bool bool this value is true if at least one address responded to at least 50% of the echo requests ipv4 array\<protocolpingresult> array\<protocolpingresult> ipv6 array\<protocolpingresult> array\<protocolpingresult> protocolpingresult this interface is not recommended unless you are using brightsign os v8 3 45 and later address string string the ip address pinged up bool bool if true , the address responded to at least 50% of the echo requests report protocolpingreport protocolpingreport protocolpingreport this interface is not recommended unless you are using brightsign os v8 3 45 and later transmitted unsigned short unsigned short the number of echo requests sent received unsigned short unsigned short the number of echo replies received stats protocolpingstats protocolpingstats protocolpingstats this interface is not recommended unless you are using brightsign os v8 3 45 and later quickest unsigned long unsigned long the quickest reply received average unsigned long unsigned long the average time across all replies from address slowest unsigned long unsigned long the slowest reply received units string string the value is always "us", to indicate microseconds 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)); });