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

Documentation: Obtaining WiFiClient from ArduinoCloud object. #314

Open
Frenzoid opened this issue Apr 6, 2022 · 6 comments
Open

Documentation: Obtaining WiFiClient from ArduinoCloud object. #314

Frenzoid opened this issue Apr 6, 2022 · 6 comments
Labels
topic: documentation Related to documentation for the project type: imperfection Perceived defect in any part of project

Comments

@Frenzoid
Copy link

Frenzoid commented Apr 6, 2022

Ref to: https://forum.arduino.cc/t/getting-wificlient-from-arduinocloud-object/973385

Is there a way to get the WiFiClient object that ArduinoCloud creates when connecting to WiFi?

Best regards.

@pennam
Copy link
Collaborator

pennam commented Apr 7, 2022

Hi @Frenzoid,
you should try to call ArduinoCloud.getConnection()

inline ConnectionHandler * getConnection() { return _connection; }

and then getClient() on the returned ConnectionHandler Object https://github.com/arduino-libraries/Arduino_ConnectionHandler/blob/98db5e61bfde16e8f0be1aca008749cc106a7745/src/Arduino_WiFiConnectionHandler.h#L41

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: documentation Related to documentation for the project labels Apr 7, 2022
@Frenzoid Frenzoid closed this as completed Apr 7, 2022
@Frenzoid Frenzoid reopened this Apr 11, 2022
@pennam
Copy link
Collaborator

pennam commented Apr 12, 2022

Hi @Frenzoid do you need more help or we can close it ?

@Frenzoid
Copy link
Author

Frenzoid commented Apr 12, 2022

Hello,

My issue is solved, but after talking with some peeps in the forums I've reopened so that devs can track this issue ( missing documentation/clarification regarding this function ).

Yet, if you want to close it, feel free to do so :)

Best regards.

@Frenzoid Frenzoid changed the title Question: Obtaining WiFiClient from ArduinoCloud object. Documentation: Obtaining WiFiClient from ArduinoCloud object. Apr 12, 2022
@Isaacbg84
Copy link

Isaacbg84 commented Mar 30, 2024

My issue is solved

Hi Frenzoid,

Thank you for raising this issue. A lot of libraries requiere to use wifi objects to send data. Im currently trying to use HTTPClient on ESP8266 and ESP32 and they requiere to declare the connection object to use. Normally you would use the WiFiClient object but with ArduinoCloud there is no documentation on how to access this and examples other than diggin up in git and forums.

Regards

@pennam
Copy link
Collaborator

pennam commented Apr 2, 2024

@Isaacbg84 see answer above.

Using the method above you will get the Client ArduinoCloud is using to connect to the mqtt broker, if you need to keep ArduinoCloud and another connection, to be used with HTTPClient, running i would declare a new WiFiClient object instead of using the ArduinoCloud one.

@Isaacbg84
Copy link

@Isaacbg84 see answer above.

Using the method above you will get the Client ArduinoCloud is using to connect to the mqtt broker, if you need to keep ArduinoCloud and another connection, to be used with HTTPClient, running i would declare a new WiFiClient object instead of using the ArduinoCloud one.

Got it. I was trying to use ArduinoIoT WiFiConnectionHandler object for this, but your answer makes a lot more sense. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: documentation Related to documentation for the project type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

4 participants