I want to upgrade my program to the new the Eliom syntx let%rpc
I found here in the readme here GitHub - ocsigen/eliom: Multi-tier framework for programming web and mobile applications in OCaml.
but I get:
Error: Uninterpreted extension ‘rpc’.
What is the difference with server_function?
I’m using Eliom 7 with Ocsigen Start 5
This syntax is part of an external package ocsigen-ppx-rpc.
Install it with opam if not already installed.
Then add it in your dune file (or to your command-line in Makefile):
(preprocess (pps ocsigen-ppx-rpc))
Or for people who are not using Ocsigen Start:
(preprocess (pps ocsigen-ppx-rpc --rpc-raw))
This syntax is just syntactic sugar for server-functions
I would recommend to upgrade to Eliom 10 (there should be very few incompatibilities).
I replace the server_function by
let%rpc get_data_rpc (bucket : int) : unit Lwt.t =
Os_session.connected_wrapper get_data bucket
Is it ok?
You don’t need the conected_wrapper any more. It is added automatically by the syntax extension (if not used with
--rpc-raw). Just define your server side function with
let%rpc instead of
let and it will be available both on server and client sides.
let%rpc get_data (bucket : int) : unit Lwt.t = ...
If you want to have the information about the current user, call functions like
Thank you. It works
I updated to the last version