.TH "Eliom_bus" 3o 2014-07-10 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 See the Eliom manual for a detailed introduction to the concept of \&. .sp .sp .sp .sp .I type .B ('a, 'b) .I t .sp .sp .I val stream : .B ('a, 'b) t -> 'b Lwt_stream.t .sp .B stream b returns the stream of data sent to bus .B b \&. A new stream is created each time this function is called\&. Some messages from the bus can be lost if they were sent before the call to .B stream \&. If you need to receive every message, use original stream instead\&. .sp .sp .I val original_stream : .B ('a, 'b) t -> 'b Lwt_stream.t .sp .B stream b returns the stream of data sent to bus .B b \&. A new stream is created each time this function is called\&. Every messages sent to the bus after the generation of the page are received\&. This function can be called only in the onload event handler, if called outside, it will raise a Failure\&. .sp .sp .I val write : .B ('a, 'b) t -> 'a -> unit Lwt.t .sp .B write b v send .B v to the bus .B b \&. Every participant of the bus will receive .B v , including the sender\&. .sp .sp .I val close : .B ('a, 'b) t -> unit .sp after .B close b , .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\&. .sp .sp .I val set_queue_size : .B ('a, 'b) t -> int -> unit .sp To reduce traffic from the client busses try to send messages by group\&. .B set_queue_size bus size set the maximum number of messages that are accumulated before forcing a flush\&. default is 20 .sp .sp .I val set_time_before_flush : .B ('a, 'b) t -> float -> unit .sp .B 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\&. .sp .sp