package eliom

  1. Overview
  2. Docs
Advanced client/server Web and mobile framework

Install

Dune Dependency

Authors

Maintainers

Sources

10.4.1.tar.gz
md5=218bcb5cd275cc05be06574c5fa357fa
sha512=edbf8b084ec1b7439d4715199c22eb925a77a2dcfbe76bb5bbc4b9d076b70be1b0de74f9eab9dfb7854df28d65eb31a4c17380528d4a461d9c2a4222abe804cc

doc/eliom.server/Eliom_notif/module-type-S/index.html

Module type Eliom_notif.SSource

Signature of the functors Eliom_notif.Make and Eliom_notif.Make_Simple.

S has two types of notifications (server_notif and client_notif) because we might need to serialise and deserialise the notification twice (in case of a multi-server set-up). Once for broadcasting it to other servers and once for transferring it to the client (after possibly transforming the message using information which is only locally available (see prepare below).

Sourcetype identity

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.

Sourcetype key

key is the type of values designating a given resource.

Sourcetype server_notif

server notification type; Can be different from client_notif.

Sourcetype client_notif

client notification type; Can be different from server_notif.

Sourceval init : unit -> unit Lwt.t

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.

Sourceval deinit : unit -> unit

Deinitialise/deactivate the notification module for the current client.

Sourceval listen : key -> unit

Make client process listen on data whose index is key

Sourceval unlisten : key -> unit

Stop listening on data key

Sourcemodule Ext : sig ... end
Sourceval notify : ?notfor:[ `Me | `Id of identity ] -> key -> server_notif -> unit

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.

Sourceval client_ev : unit -> (key * client_notif) Eliom_react.Down.t

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)

Sourceval clean : unit -> unit

Call clean () to clear the tables from empty data.

OCaml

Innovation. Community. Security.