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

Please add a "onWiFiConnectionEstablished" callback #76

Open
ikarisan opened this issue Dec 23, 2020 · 2 comments
Open

Please add a "onWiFiConnectionEstablished" callback #76

ikarisan opened this issue Dec 23, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@ikarisan
Copy link

I am trying to use you MQTT library together with NTPClient libraries. These libraries require at least to wait for an established WiFi connection, before asking a NTP server. Would it be possible to include a onWiFiConnectionEstablished() method as well? Maybe the MQTT broker is not reachable but the WiFi is already usable.

A client.getWiFiConnection() would also be nice, because some libraries require to pass a reference to a WiFi or WiFiUdp object.

@ikarisan ikarisan added the enhancement New feature or request label Dec 23, 2020
@kintel
Copy link

kintel commented Feb 4, 2022

I was just looking into this. This should be possible to do yourself using WiFi events, smth. like this for esp32:

...
WiFi.onEvent(onWiFiConnectionEstablished, WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_GOT_IP)
...

void onWiFiConnectionEstablished(WiFiEvent_t event, WiFiEventInfo_t info) {
}

There should be opportunities, in the dev version of this library, to add such a convenience function though.

@kintel
Copy link

kintel commented Feb 9, 2022

@plapointe6 what's your opinion on using magic functions like onConnectionEstablished, which the user has to implement? If it's just a single function, it's quite user friendly, but it can become a bit messy if there are more signals we'd like to expose. Like WiFi connection status.

Allowing users to register callbacks is more classic, but that could introduce an incompatibility with the current version of the library. Not sure if that's a big issue..

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

No branches or pull requests

2 participants