Documentation: Obtaining WiFiClient from ArduinoCloud object.
Frenzoid opened this issue · 6 comments
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.
Hi @Frenzoid,
you should try to call ArduinoCloud.getConnection()
ArduinoIoTCloud/src/ArduinoIoTCloud.h
Line 105 in 451d57d
and then getClient()
on the returned ConnectionHandler Object https://github.com/arduino-libraries/Arduino_ConnectionHandler/blob/98db5e61bfde16e8f0be1aca008749cc106a7745/src/Arduino_WiFiConnectionHandler.h#L41
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.
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
@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 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.