Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more.
0

Trying to do an out of band HTTP POST while using io.connect
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

Trying to do an out of band HTTP POST while using io.connect

by klif on Thu Mar 12, 2020 7:39 pm

I have a working Adafruit IO application that establishes an io.connect() session and can receive and send data just fine. Now I'd like to use an my own messaging server that takes a raw HTTP GET request. Since WiFi is already configured by the "io.config()" is there a way that I can add on a call to another HTTP web server to send that put request? I tried using WiFi client but it just wouldn't pick up on the existing WiFi connection. Or at least I didn't know enough to get it to do so. So essentially, with a working io.connect() session I'd like to add something like a WiFiClient connect to a new HTTP server and then issue a GET request for a new URL. I hope this is explained well enough. At a high level I have an ESP8266 connected to Adafruit IO sending and receiving data. At some point I'd like to send an HTTP GET request to a different web server to send an email message. I just can't figure out how to make that second HTTP request.

Any help or pointers are appreciated.
-K

klif
 
Posts: 2
Joined: Thu Mar 12, 2020 7:26 pm

Re: Trying to do an out of band HTTP POST while using io.con

by klif on Sat Mar 14, 2020 6:05 pm

Well I'm kind of answering my own question here. I did manage to get this working, but what I had to do is just include all the ESP8266WiFi headers. Then instantiated a new ESP8266WiFiMulti, WiFi Client and HTTPClient. Essentially creating a complete second wifi client connection. I just couldn't find a way of accessing the WiFi client that was buried in the Adafruit IO. At least this worked but it seems like hitting it with a hammer rather than a scalpel.

klif
 
Posts: 2
Joined: Thu Mar 12, 2020 7:26 pm

Re: Trying to do an out of band HTTP POST while using io.con

by brubell on Tue Mar 17, 2020 11:12 am

Creating a second WiFi client may be best solution here - Adafruit IO Arduino's WiFiClient should be used for Adafruit IO only.

brubell
 
Posts: 792
Joined: Fri Jul 17, 2015 10:33 pm

Please be positive and constructive with your questions and comments.