friedrith / node-wifi

📶 NodeJS tool to manage wifi (connections, scans)
MIT License
396 stars 160 forks source link

Linux: getCurrentConnections sometimes does not return the SSID name #139

Open zeved opened 3 years ago

zeved commented 3 years ago

Hello, I love this package!

However, on Debian (will check tomorrow on Ubuntu) sometimes the getCurrentConnections returns an empty SSID in the connections list:

[
  {
    iface: 'wlan0',
    ssid: '',
    bssid: '12:34:56:78:90:AA',
    mac: '12:34:56:78:90:AA',
    mode: 'Infra',
    channel: 36,
    frequency: 5180,
    signal_level: -50,
    quality: 100,
    security: 'WPA2',
    security_flags: { wpa: '(none)', rsn: 'pair_ccmp group_ccmp psk' }
  }
]

[
  {
    iface: 'wlan0',
    ssid: 'Unknown SSID',
    bssid: '12:34:56:78:90:AA',
    mac: '12:34:56:78:90:AA',
    mode: 'Infra',
    channel: 36,
    frequency: 5180,
    signal_level: -59.5,
    quality: 81,
    security: 'WPA2',
    security_flags: { wpa: '(none)', rsn: 'pair_ccmp group_ccmp psk' }
  }
]

Expected Behavior

When querying the current connections the function should return the correct SSID every time for the same network.

Current Behavior

Sometimes the getCurrentConnections() function returns the info object with an empty SSID value

Affected features

Steps to Reproduce (for bugs)

call getCurrentConnections repeatedly and analyze the result

Context

I am using your package in an NodeJS server for an Electron app and I need to poll the status of the Wifi connection every 5 seconds.

Your Environment

Edit: 'Unknown SSID' is the actual name of my Wifi, no error there :grin: