package ocsigen-ppx-rpc

All checked builds pass
  1. Overview
  2. Docs
This PPX adds a syntax for RPCs for Eliom and Ocsigen Start

Install

dune-project
 Dependency

Authors

Maintainers

Sources

2.0.tar.gz
md5=6c69429c3c7b155c34b343f07e797ce7
sha512=7403540f364667afe5b7942efed8aa67540779809002691ded1d6f8ee51211d25d481c673a9b069f4bab910cf21e5143d96f3c554db1264326394c3518c060ec

Description

Added to opam-repository:

README

ocsigen-ppx-rpc

This PPX adds a syntax for RPCs for Eliom and Ocsigen Start.

Installation

ocsigen-ppx-rpc can be installed via OPAM:

opam install ocsigen-ppx-rpc

Buildsystem integration

With Dune, you should add a preprocess directive to your target:

  (executable
(libraries whatever)
(preprocess (pps ocsigen-ppx-rpc))
(name blah))

Usage

This PPX let you defined RPCs:

let%rpc f (x1 : t1) ... (xn : tn) = e

These functions are defined server-side and can be used both on the client and on the server.

An additional initial parameter can be used to refer to the current user following Ocsigen Start's convention:

let%rpc f myid (x1 : t1) ... (xn : tn) = e
let%rpc f myid_o (x1 : t1) ... (xn : tn) = e

It is automatically bound: it does not have to provided when invoking the function

Parameters can also be named ~(x : t) or optional ?(x : t option). A unit parameter is allowed at the very end, which can be convenient when using optional parameters:

let%rpc f ?(x1 : t1) ... ~(xn : tn) () = e

By default, this PPX is meant to be used together with Ocsigen Start. So, it automatically inserts Os.Session wrappers. If you want to use it with Eliom but without Ocsigen Start, you can use the option --rpc-raw

  (executable
(libraries whatever)
(preprocess (pps ocsigen-ppx-rpc --rpc-raw))
(name blah))

The option --rpc-internal is used when compiling Ocsigen Start itself: the wrappers are emitted with the short module names its modules use for each other (Session, Current_user, ...).

Version 2.0 emits the module names introduced by Eliom 13 and Ocsigen Start 9 (Eliom.Client, Os.Session, ...), so it requires Eliom >= 13 in all modes, and Ocsigen Start >= 9 in the default mode. Use ocsigen-ppx-rpc 1.x with older versions.

Dependencies (2)

  1. ppxlib >= "0.37.0"
  2. dune >= "2.8"

Dev Dependencies

None

Optional Dependencies

None

Conflicts (2)

  1. ocsigen-start < "9.0~"
  2. eliom < "13.0~"

Build status

Results of building ocsigen-ppx-rpc with each compiler on check.ci.ocaml.org, run of against opam-repository 8d8d144. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
2.0 (this version) good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure