What are my options for doing Native OCaml <=> Erlang <=> Browser (js_of_ocaml and/or bucklescript) RPC?

I’ve been reading about various ways of doing RPC, though still haven’t started testing… but I am already quite lost.

Here is what I know so far, please correct me for where I’m wrong and other suggestions are very welcome.

  1. gRPC - Currently not available for OCaml, as there is no HTTP2 support
  2. Apache Thrift - seems to be officially supported by Apache, but really doubtful it will work in the browser
  3. piqi - this project seems to be quite silent since 2014. I asked here if it will work in the browser: https://groups.google.com/forum/#!topic/piqi/yjZA42ZXobc
  4. Cap’N Proto which here only seems to support JS in node.js, so probably it won’t work in the browser for OCaml either.

So what would you guys do if you were to implement something like this?
In general, this question can be simplified if we remove the Erlang from the equation… but then still, what would you do in order to implement RPC between native and in-browser OCaml of some sort?

1 Like

Have you taken a look at ocaml-rpc?

1 Like

There is also Async_rpc_kernel if you are using the Async ecosystem. You can use something like websockets to provide a transport layer for the async RPC machinery.

Indeed, we haven’t a version of this internally that we’ve been discussing releasing.


I’m not sure it solves your problem with Erlang, but I just wanted to remind in this thread that Ocsigen Eliom makes it possible to call server side OCaml functions directly from client side programs (js_of_ocaml).

See for example http://ocsigen.org/eliom/6.3/manual/clientserver-communication



1 Like