Skip to content

Feature request: http and https client examples in C #318

Open
@a-h

Description

@a-h

I want to post data from sensors over HTTPS in JSON format, and ideally, also using MQTT.

This seems very difficult with the C API, but is trivial with the urequests API in MicroPython.

On the ESP32, the included WiFiClientSecure type makes the same task simple too.

So far, I've spent hours trying to get something up and running on the Pico W without success.

Reading through https://www.i-programmer.info/programming/hardware/15838-the-picow-in-c-simple-web-client.html got me up and running with a HTTP request, but that's not very useful, since a lot of cloud infrastructure doesn't support unencrypted transports. Regardless, I think it would be a good addition to the examples.

I've looked at https://github.com/cniles/picow-iot but couldn't get it to build. It seems outdated, since the Pico SDK seems to have some support for mbedTLS now. The author didn't get any help on his questions about performance at https://forums.raspberrypi.com/viewtopic.php?t=339620 so I'm not sure if it works anyway.

This unmerged PR seems like it's starting to get to the right place, but it's still very much at the TCP side, rather than higher level. #305 - it doesn't make use of the httpc_get_file_dns function, for example.

Reading through this blog post makes it look like it's possible to do HTTPS, but I don't know how to connect the pieces -
https://www.unshiu.com/posts/pico-http-client-part-iii-mbedtls/ - Finally, it seems that the author gave up on the Pico SDK, and switched to try out FreeRTOS (https://www.unshiu.com/posts/pico-with-freertos/)

I think there's two things that would help the developer experience here:

  1. Examples of HTTP and HTTPS connectivity with the existing tools.
  2. Addition of a higher level API for HTTPS requests built into the Raspberry Pi SDK to simplify it.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions