Skip to main content

Module http_sync

Module http_sync 

Source
Expand description

Channel-based bridge allowing synchronous HTTP calls from Wasmtime host function runtime::host_api::http.

Due to potenial memory corruption issues with multiple EspHttpClient instances, all http request are processed by http_handler_task even for async functions.

Core 1 (widget)          Core 0 (embassy)
───────────────          ────────────────
http_request_sync()  ──► HTTP_REQUEST_CHANNEL
  polls with 10ms         http_handler_task() dequeues
  RTOS yields       ◄──  HTTP_RESPONSE_CHANNEL

Timeout on both sides: 30 seconds.

Structs§

HttpRequest
An HTTP request queued from the synchronous widget side to the async handler.

Constants§

ASYNC_BRIDGE_TIMEOUT 🔒

Statics§

HTTP_REQUEST_CHANNEL 🔒
HTTP_RESPONSE_CHANNEL 🔒

Functions§

http_handler_task
Async task that handles HTTP requests from the channel Run on Core 0.
http_request_async
Asynchronous HTTP request function callable from async context.
http_request_sync
Synchronous HTTP request function called from WIT host functions Widget execution is halted until this function returns or times out.

Type Aliases§

HttpResponse