ferristseng / rust-ipfs-api

IPFS HTTP client in Rust
Apache License 2.0
247 stars 68 forks source link

Wasm support #73

Closed SionoiS closed 2 years ago

SionoiS commented 3 years ago

Opening this issue for tracking and to help me remember caveats.

https://github.com/seanmonstar/reqwest/issues/1141 https://github.com/seanmonstar/reqwest/pull/1151 https://github.com/seanmonstar/reqwest/pull/1020 https://github.com/seanmonstar/reqwest/pull/1013

Will have to wait for crate split #43, async multipart #58, and reqwest support #69.

SionoiS commented 3 years ago

Seems like Tokio can't be compiled for wasm32-unknown-unknown because of mio dependency, which is a big deal...

I will probably create a small ipfs api for wasm for my own use, if I even can.

tennox commented 1 year ago

@SionoiS I'm also looking to use ipfs client in wasm. Did you find a solution?

Seems tokio is mainly used with hyper backend, so the reqwest backend should be a possible solution, no?

tennox commented 1 year ago

Edit: Found this crate which compiles successfully to wasm. Some more testing needed though :thinking: https://lib.rs/crates/semtexzv-ipfsapi

SionoiS commented 1 year ago

@tennox

https://lib.rs/crates/semtexzv-ipfsapi Not async which is weird when used on other targets.

My code is at https://github.com/Defluencer/rust-defluencer/tree/develop/ipfs-api Not published though.

tennox commented 1 year ago

@tennox

https://lib.rs/crates/semtexzv-ipfsapi Not async which is weird when used on other targets.

I think it is async 🧐 Started forking it to add dag support...

My code is at https://github.com/Defluencer/rust-defluencer/tree/develop/ipfs-api Not published though.

...but thanks for this it's a good reference 😎

SionoiS commented 1 year ago

The best would be to implement a backend with reqwest. I may be more feasible than last year.

I don't know if you got time to look into it.

tennox commented 1 year ago

The one from @semtexzv is with reqwest https://docs.rs/semtexzv-ipfsapi/latest/src/semtexzv_ipfsapi/pubsub.rs.html#79-87 🧐

SionoiS commented 1 year ago

I meant to say update rust-ipfs-api to include a backend that compile to wasm.

tennox commented 1 year ago

Oh , now i get it! that's actually an intruiging idea 🤔