This is client API (go to server)

Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Eliom_bus

module Eliom_bus : sig..end

Broadcasting facilities between clients and server


type 'a t
val stream : 'a t -> 'a Lwt_stream.t
val write : 'a t -> 'a -> unit Lwt.t

stream b returns the stream of datas sent to bus b. Notice you sould not use that function multiple times on the same bus in the same client process, it will return the same stream. If you want to receive mutiple times the same datas, you sould copy the stream with Lwt_stream.clone

val close : 'a t -> unit

write b v send v to the bus b. Every participant of the bus will receive v, including the sender.

val set_queue_size : 'a t -> int -> unit

after close b, stream b stops receiving new messages from the bus, but it is still possible to write to the bus. It is also possible to close the bus by canceling a thread reading on the stream.

val set_time_before_flush : 'a t -> float -> unit

To reduce traffic from the client busses try to send messages by group. set_queue_size bus size set the maximum number of messages that are accumulated before forcing a flush. default is 20


set_time_before_flush bus time set the maximum time to wait for a new message to enqueue before flushing. Set this to a small value to make your app more responsive, but remember that it will consume more bandwidth. default is 0.05 second.