Connected Network

Class Reference
API Reference

obniz.js v3.18.0 or later

Obtains information about the network to which the device is actually connected.
You can check the information available in the device management screen.
The information that can be obtained depends on the version of obnizOS and the network being connected. Please refer to the reference for details.

Information can be retrieved from connected_networks after obniz.js has connected to the device.

// Javascript Full Example

var obniz = new Obniz("OBNIZ_ID_HERE");
obniz.onconnect = async function () {
  console.log(obniz.connected_network);

  if (obniz.connected_network) {
    console.log(obniz.connected_network.online_at); // ex) 1637685862
    console.log(obniz.connected_network.local_ip);  // ex) 192.168.0.100
    console.log(obniz.connected_network.global_ip); // ex) 201.200.199.198
    if (obniz.connected_network.wifi) {
      console.log(obniz.connected_network.wifi.ssid); // ex) obniz-wifi
      console.log(obniz.connected_network.wifi.rssi); // ex) -70
    }
  }
}