package eliom
Install
Dune Dependency
Authors
Maintainers
Sources
md5=3aeeca5f734f8e932b5a00fbfd43bd26
sha512=d92948949c81fe5b84f7d262b72653175d4f69574cbb4f85433f3a40df436e9e78b3f024ebcd98cb0e1c8ec45af0e3f9cd1153187549883f4ddfd32feeee3176
doc/eliom.server/Eliom_notif/Make/index.html
Module Eliom_notif.Make
Source
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
.
Note: The communication between servers is not implemented in this module. To `plug in' your method of transporting notifications between servers you can override S.notify
. See the manual for an example (coming soon).
Parameters
Signature
identity
is the type of values used to differentiate one listener from another. Typically it will be a user, but it could also for instance be a chat window.
server notification type; Can be different from client_notif
.
client notification type; Can be different from server_notif
.
Initialise the notification module for the current client. This function needs to be called before using most other functions of this module. It isn't called implicitly during module instantiation because it relies on identity data which might not be available yet.
Deinitialise/deactivate the notification module for the current client.
Call notify key n
to send a notification n
to all clients currently listening on data referenced by key
.
If ~notfor
is `Me
, notification will not be sent to the tab currently doing the request (the one which caused the notification to happen). Note that if notify
is called with ~notfor:`Me
outside of a request it will fail. If it is `Id id
it won't be sent to the destination defined by id
.
Returns the client react event.
'a Eliom_react.Down.t
= 'a React.E.t
on client side.
Map a function on this event to react to notifications from the server. For example:
let%client handle_notification some_stuff ev = ...
let%server something some_stuff = ignore %client (ignore (React.E.map (handle_notification ~%some_stuff) ~%(Notif_module.client_ev ()) ) : unit)
Call clean ()
to clear the tables from empty data.