Module Session.Handler

Session handlers.

type ('a, 'e) t = ('a'e) handler
val v : load:('a state -> Webs.Req.t -> ('a option'e) Stdlib.result) -> save:('a state -> 'a option -> Webs.Resp.t -> Webs.Resp.t) -> unit -> ('a'e) handler

handler ~load ~save () is a session handler using load to setup the session state and save to save it before responding.

Sessions as are represented by 'a option values. On load a None indicates there is no session. On save a None indicates to drop the session.

Warning. save gets invoked iff the state to save is different from the one that was loaded.

val load : ('a'e) handler -> 'a state -> Webs.Req.t -> ('a option'e) Stdlib.result

load h is the state loading function of h.

val save : ('a'e) handler -> 'a state -> 'a option -> Webs.Resp.t -> Webs.Resp.t

save h is the state saving function of h.