elastic / elasticsearch-rs

Official Elasticsearch Rust Client
https://www.elastic.co/guide/en/elasticsearch/client/rust-api/current/index.html
Apache License 2.0
695 stars 70 forks source link

Allow running on wasm32 targets using fetch() for http requests #200

Open swallez opened 2 years ago

swallez commented 2 years ago

The reqwest library has a webassembly backend that uses the fetch() function available in web browsers and node.js environments.

This PR enable the wasm32 target by adding conditional compilation where needed to allow the use of this target. In particular, all features related to SSL/TLS configuration are not available for this target since it is handle by the host webassembly runtime.

Some standalone examples are added to showcase the use of webassembly in a web browser and in a Cloudflare worker.