Add timeout option for connectToProtectedSSID
See original GitHub issueFeature description
Add configurable timeout option. When the phone couldn’t connect to access point in the specified time, cancel the attempt and reject the promise with error timeoutOccurred.
On iOS this timeout behaviour has to be added completely. On Android this is already an option in the native dependency used (https://github.com/ThanosFisherman/WifiUtils) but we don’t allow setting it yet.
New method signature
If we don’t want to break the lib for users that upgrade, we could add a new method: connectToProtectedSSID(SSID, password, options: Object): Promise Options:
- isWep: boolean: Used on iOS, …
- timeout: int: Maximum time the phone can try to get connected. After this, the connection attempt is cancelled and the promise is rejected. Default is 45 seconds.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
react-native-wifi-reborn - npm
A react-native implementation for viewing and connecting to Wifi networks on Android and iOS devices.. Latest version: 4.7.0, ...
Read more >react native - most likely the callback was already invoked
I got this error when trying to use react-native-wifi-reborn to connect with with. Invariant Violation: No callback found with cbID 2567 and ...
Read more >useTimeout, a setTimeout hook for React - Josh W Comeau
export default function useTimeout(callback, delay) { ... Then, 5 seconds later, it'll re-render with hasTimeElapsed set to true.
Read more >Using setTimeout in React components (including hooks)
Setting the number to null will disable the timeout, and it also automatically cancels it when the component unmounts. The code of the...
Read more >lib/types/index.d.ts - jsDelivr
timeoutOccurred = 'timeoutOccurred', } /** * Connects to a WiFi network. ... export function connectToProtectedSSID( SSID: string, password: string | null, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Firstly apologies for wading in, I have just discovered this library, and it’s exactly what I need.
My own personal view is that using the named parameters approach to function signatures makes adding new features (such as this) trivial in the future. In this case, a short-term breaking change to a sig such as the following would benefit the library in the longer term:
With this in place, more options can be easily added to this at a later date, providing they are optional.
Of course, there is the downside of inconvenience for existing users, but in most cases a simple refactor should suffice, especially if this is released as a major version bump with clear migration instructions.
Thanks for maintaining this library, whatever decision is taken here, it would be great to have a timeout option.
any update on this?