.TH "Eliom_bus" 3o 2012-06-11 OCamldoc "" .SH NAME Eliom_bus \- Broadcasting facilities between clients and server .SH Module Module Eliom_bus .SH Documentation .sp Module .BI "Eliom_bus" : .B sig end .sp Broadcasting facilities between clients and server .sp .sp .sp .sp .I type .B 'a .I t .sp The type of bus\&'s carrying values of type .B \&'a \&. Bus\&'s are values that can be easily shared among clients\&. Each of these clients along with the server can send a value on the bus\&. Values can be received by each of the participants as a stream\&. Note that no effort is put to order message receptions on the different participants\&. .sp .sp .I val create : .B ?scope:[< Eliom_comet.Channel.comet_scope ] -> .B ?name:string -> ?size:int -> 'a Deriving_Json.t -> 'a t .sp .B create ?scope ?name ?size makes a fresh bus\&. The .B name optional parameter can be used to make persistent (as in server restart persistent) bus\&'s\&. The .B scope parameter is used to chose the kind of channel on which the bus rely (See .B Eliom_comet\&.create for more information)\&. The .B ?name argument allow one to make bus\&'s persistent over server restart\&. The .B size argument behaves like the one on .B Eliom_comet\&.Channel\&.create .sp .sp .I val stream : .B 'a t -> 'a Lwt_stream.t .sp .B stream b returns the stream of datas sent to bus .B b \&. Notice you sould not use that function multiple times on the same bus, it will return the same stream\&. If you want to receive multiple times the same datas, you sould copy the stream with .B Lwt_stream\&.clone .sp .sp .I val write : .B 'a t -> 'a -> unit .sp .B write b x sends the value .B x on the bus .B b \&. Every participant, including the server, will receive .B x \&. .sp .sp