package ocsigen-ppx-rpc

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

1.1.tar.gz
md5=314c601099e3371b776001a278209fdc
sha512=035ebb4e8b29a9b64fc04e5f060af2fe4c572f4b5d3389db11950a5dbe31c8ece709db374e2acdcb5a4192b5f363674db8494678be8d410cfd7b5d350a728d13

Description

Published: 19 Feb 2026

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 ppx_deriving

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))

Dependencies (2)

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

Dev Dependencies

None

Used by (1)

  1. ocsigen-start >= "4.6.0"

Conflicts

None