Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a .isConnected() method to check if the target wifi is connected or not? #151

Open
1 of 2 tasks
mrdulin opened this issue Mar 30, 2021 · 1 comment
Open
1 of 2 tasks

Comments

@mrdulin
Copy link

mrdulin commented Mar 30, 2021

Expected Behavior

Is there a .isConnected() method to check if the target wifi is connected or not?

Current Behavior

I am trying to use wifi.scan() method to get the information of the networks.

// disconnected
{
  mac: 'd4:c8:b0:06:a1:71',
  bssid: 'd4:c8:b0:06:a1:71',
  ssid: 'ZA-Office',
  channel: 36,
  frequency: 5180,
  signal_level: '-69',
  quality: 62,
  security: '',
  security_flags: []
},
// connected
{
  mac: '44:6a:2e:10:44:31',
  bssid: '44:6a:2e:10:44:31',
  ssid: 'ZA-Office',
  channel: 36,
  frequency: 5180,
  signal_level: '-92',
  quality: 16,
  security: '',
  security_flags: []
}

There is no field to indicate whether the network is connected.

Affected features

  • node API
  • cli

Context

I want to implement a function that automatically reconnects when wifi is disconnected.

Your Environment

  • OS: macOS 10.15.7 (19H524)
  • node-wifi version: "node-wifi": "^2.0.14",
  • wifi card: Don't know
@juanmartin
Copy link

You can use .getCurrentConnections() and compare the results to check if you're on the right network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants