package eliom
Install
Dune Dependency
Authors
Maintainers
Sources
md5=3aeeca5f734f8e932b5a00fbfd43bd26
sha512=d92948949c81fe5b84f7d262b72653175d4f69574cbb4f85433f3a40df436e9e78b3f024ebcd98cb0e1c8ec45af0e3f9cd1153187549883f4ddfd32feeee3176
doc/eliom.server/Eliom_notif/index.html
Module Eliom_notif
Source
Server to client notifications.
This module makes it possible for client side applications to be notified of changes on some indexed data (resources) on the server.
Apply functor Make
or Make_Simple
for each type of data you want to be able to listen on. Each client starts listening on one piece of data by calling function listen
with the index of that piece of data as parameter. Client stops listening by calling function unlisten
, or when the client side state is closed (by timeout or when the client disconnects for example).
When the data is modified on server side, call function notify
with the index of the data, and all clients listening to that piece of data will receive a notification.
The functor will also create a client side react signal that will be updated every time the client is notified.
See module Os_notif in Ocsigen Start for an example of use.
Signature of the functors Eliom_notif.Make
and Eliom_notif.Make_Simple
.
module Make
(A : ARG) :
S
with type identity = A.identity
and type key = A.key
and type server_notif = A.server_notif
and type client_notif = A.client_notif
Use this functor if you need to customise your notifications with client-specific data (or block notifications for specific clients). This is made to work specifically in a multi-server set-up as well, where In a multi-server set-up notifications might need to be serialised twice, once before broadcasting them to the other servers (without client information present), and then once more to forward them to the clients possibly augmenting it with client-specific data or block for specific clients; see ARG.prepare
.
ARG_SIMPLE
is for making Make_Simple
module Make_Simple
(A : ARG_SIMPLE) :
S
with type key = A.key
and type server_notif = A.notification
and type client_notif = A.notification
Use this functor if you have no need of customising your notifications with client-specific data.