Cross-platform http client


It doesn’t look like there’s an http client library that works both on bucklescript and on native with the same api (please correct me if I’m wrong about this). Writing one requires having a cross-platform promises api that wraps JS.Promise on bucklescript and either lwt or async on native. Is anyone working on this? Would it be possible to make a “polyfill” for eg: Async.Deferred that wrapped JS.Promise on bucklescript? If it’s possible that makes more sense to me than inventing a new api because the ocaml community has had years to discover the warts in Async and lwt.


I would really like to know this as well, it would be great if the reason knowledge gained could be applied to writing native server applications.


It would be a major selling point for companies to be able to unify their Http Clients across platforms, any news about it ?


Someone would need to write a wrapper with a common API surface over BuckleScript (targeting e.g. JavaScript Promise) and native (targeting e.g. Lwt). The approach could be similar to what the Dark team is doing with Tablecloth.

Short of that, another option is to use js_of_ocaml, which can compile most existing native-targeted code (e.g. Lwt) to JavaScript. Of course, js_of_ocaml is a separate compiler, however it is specifically meant to handle this native/JavaScript cross-compilation scenario, so it may be the best option for a truly portable async HTTP client right now.


There’s which wraps Lwt, Js.Promises and Luv (, combined with something like I’d say that’s a pretty good start!


I think that the ecosystem lacks of a Async primitive. Http-client will be built on top of this primitive.

This sounds like a good start but I’m wondering about the status of repromise project


I asked the other day, and it’s still active! :slightly_smiling_face:

I might experiment a bit this weekend, but there are efforts happening (Refetch, Revery, anurag etc) might ”just” be a question of combining them!


Has there been any progress on this? Sounds like an awesome idea to create a unified client.